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:
parent
15c62583a2
commit
6d06ee3430
4 changed files with 139 additions and 19 deletions
|
@ -183,6 +183,13 @@ namespace Tests
|
|||
IFaceA ifa = cba;
|
||||
Test.Assert(ifa.GetType() == typeof(ClassB));
|
||||
|
||||
ClassF cf = scope .();
|
||||
TestIFaceD(cf);
|
||||
Test.Assert(cf.mA == 999);
|
||||
ClassG cg = scope .();
|
||||
TestIFaceD(cg);
|
||||
Test.Assert(cg.mA == 999);
|
||||
|
||||
GameItem gameItem = scope .();
|
||||
var hitbox = GetHitbox(gameItem);
|
||||
Test.Assert(hitbox.mArea == .() { x=1, y=2, width=3, height=4 });
|
||||
|
@ -267,6 +274,47 @@ namespace Tests
|
|||
return T.SMethod2(val.GetVal());
|
||||
}
|
||||
|
||||
interface IFaceD
|
||||
{
|
||||
int32 Val
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassF : IFaceD
|
||||
{
|
||||
public int32 mA;
|
||||
|
||||
int32 IFaceD.Val
|
||||
{
|
||||
get
|
||||
{
|
||||
return mA;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
mA = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ClassG : ClassF
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void TestIFaceD<T>(T val) where T : IFaceD
|
||||
{
|
||||
val.Val = 999;
|
||||
}
|
||||
|
||||
static int TestIFaceD2<T>(T val) where T : IFaceD
|
||||
{
|
||||
return val.Val;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestDefaults()
|
||||
{
|
||||
|
@ -297,6 +345,15 @@ namespace Tests
|
|||
Test.Assert(v == 3234);
|
||||
v = SGet2<ClassE, int16>(ce);
|
||||
Test.Assert(v == 4234);
|
||||
|
||||
ClassF cf = scope .();
|
||||
TestIFaceD(cf);
|
||||
Test.Assert(cf.mA == 999);
|
||||
Test.Assert(TestIFaceD2(cf) == 999);
|
||||
ClassG cg = scope .();
|
||||
TestIFaceD(cg);
|
||||
Test.Assert(cg.mA == 999);
|
||||
Test.Assert(TestIFaceD2(cg) == 999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue