1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 14:54:09 +02:00

Fixed const expr preference in method selection

This commit is contained in:
Brian Fiete 2020-08-01 12:16:17 -07:00
parent fb960747ec
commit 91dea6cd3b
2 changed files with 69 additions and 13 deletions

View file

@ -81,6 +81,26 @@ namespace Tests
return 2;
}
public static int MethodE<T>(T val, int val2)
{
return 1;
}
public static int MethodE<T, TVal>(T val, TVal val2) where TVal : const int
{
return 2;
}
public static int MethodE<T>(List<T> val, int val2)
{
return 3;
}
public static int MethodE<T, TVal>(List<T> val, TVal val2) where TVal : const int
{
return 4;
}
[Test]
public static void TestBasics()
{
@ -115,8 +135,14 @@ namespace Tests
Test.Assert(MethodB(("A", "B")) == 3);
Test.Assert(MethodC(("A", "B")) == 3);
int[][] arrArr = new int[1][];
int[][] arrArr = scope int[1][];
Test.Assert(MethodD(ref arrArr) == 2);
int a = 100;
Test.Assert(MethodE(sa, a) == 1);
Test.Assert(MethodE(sa, 100) == 2);
Test.Assert(MethodE(sal, a) == 3);
Test.Assert(MethodE(sal, 200) == 4);
}
}
}