1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Improved virtual overrides in extensions

This commit is contained in:
Brian Fiete 2022-05-07 11:40:55 -07:00
parent 8a84647bcd
commit e1d7939081
11 changed files with 116 additions and 11 deletions

View file

@ -45,6 +45,19 @@ namespace LibA
T val = default;
return Overload0(val);
}
public virtual int GetA()
{
return 1;
}
}
extension LibA0
{
public override int GetA()
{
return 2;
}
}
struct Handler

View file

@ -42,6 +42,10 @@ namespace TestsB
Test.Assert(ca.mB == 1008);
Test.Assert(ca.mC == 9);
Test.Assert(ca.GetVal2() == 11);
LibA.LibA0 la0 = scope .();
int la0a = la0.GetA();
Test.Assert(la0a == 2);
}
}

View file

@ -57,6 +57,14 @@ extension LibClassA
namespace LibA
{
extension LibA0
{
public new override int GetA()
{
return 3;
}
}
extension LibA3
{
this
@ -386,6 +394,10 @@ namespace Tests
delete ca;
Test.Assert(LibClassA.sMagic == 7771);
LibA.LibA0 la0 = scope .();
int la0a = la0.GetA();
Test.Assert(la0a == 3);
LibA.LibA3 la3 = scope .();
Test.Assert(la3.mA == 114);
Test.Assert(la3.mB == 7);