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

Improvements to auto-impl properties

This commit is contained in:
Brian Fiete 2022-03-01 09:49:02 -08:00
parent 36e0a3a375
commit 06f4eb9576
8 changed files with 113 additions and 61 deletions

View file

@ -23,13 +23,20 @@ namespace Tests
struct StructB
{
public StructA B { get; set mut; }
public ref StructA B2 { get mut; set mut; }
int mZ = 9;
public this()
{
B = .();
#unwarn
B.mA += 1000;
StructA sa = .();
sa.mA += 2000;
B2 = sa;
B2.mA += 3000;
}
}
@ -72,8 +79,6 @@ namespace Tests
}
}
class ClassB
{
public StructA B { get; set; }
@ -118,10 +123,12 @@ namespace Tests
{
StructB sb = .();
StructA sa = sb.B;
StructA sa2 = sb.B2;
Test.Assert(sa.mA == 111);
sb.B = .(222);
sa = sb.B;
Test.Assert(sa.mA == 222);
Test.Assert(sa2.mA == 5111);
StructC sc = default;
Test.Assert(sc.C == 123);