1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-29 04:55:58 +02:00

Fixed constrained property lookups

This commit is contained in:
Brian Fiete 2021-01-19 10:40:38 -08:00
parent 15c62583a2
commit 6d06ee3430
4 changed files with 139 additions and 19 deletions

View file

@ -71,6 +71,8 @@ namespace Tests
}
}
class ClassB
{
public StructA B { get; set; }
@ -90,6 +92,26 @@ namespace Tests
public override int IVal2 { get => base.IVal2 + 100; }
}
abstract class ClassD
{
public int32 Val { get; set; }
}
class ClassE : ClassD
{
}
static void MethodC<T>(T val) where T : ClassD
{
val.Val = 999;
}
static int MethodD<T>(T val) where T : ClassD
{
return val.Val;
}
[Test]
public static void TestBasics()
{
@ -122,6 +144,11 @@ namespace Tests
ClassB cb2 = cc;
Test.Assert(cb2.IVal == 1);
Test.Assert(cb2.IVal2 == 102);
ClassE ce = scope .();
MethodC(ce);
Test.Assert(ce.Val == 999);
Test.Assert(MethodD(ce) == 999);
}
}
}