1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 07:44:09 +02:00

Fixed erroneous 'this' ctor assignment detection in struct extensions

This commit is contained in:
Brian Fiete 2022-02-13 07:41:31 -05:00
parent b341b6d3b4
commit fd4ec25e7b
4 changed files with 89 additions and 42 deletions

View file

@ -237,6 +237,28 @@ namespace Tests
return val.GetIt().GetExVal();
}
struct StructA
{
public int mVal;
public int mVal2 = 111;
public this(int val, int val2)
{
mVal = val;
mVal2 = val2;
}
}
extension StructA
{
public int mVal3 = 222;
public this(int val)
{
mVal = val;
}
}
[Test]
public static void TestBasics()
{
@ -272,6 +294,11 @@ namespace Tests
obj = new ClassG();
delete obj;
Test.Assert(ClassF.sVal == 6543);
StructA ms = .(1);
Test.Assert((ms.mVal == 1) && (ms.mVal2 == 111) && (ms.mVal3 == 222));
ms = .(1, 2);
Test.Assert((ms.mVal == 1) && (ms.mVal2 == 2) && (ms.mVal3 == 222));
}
[Test]