Unions and structs, including setting them should now work.

This commit is contained in:
Christoffer Lerno
2020-04-08 21:17:03 +02:00
parent 96c8c77e89
commit bb806716e4
8 changed files with 159 additions and 206 deletions

View File

@@ -138,9 +138,13 @@ struct AnonStruct
int x;
}
func void testAnonStruct()
{
AnonStruct s = { b2 = 3, b1 = 7, sune.b = 1 };
AnonStruct foo;
s.sune.b = 1;
s.b1 = 2;
s.b2 = 3;
@@ -153,6 +157,9 @@ func void testUnion()
SimpleUnion s;
s.a = 1;
s.f = 1.0;
s = { 1 };
int x = 2;
s = { (x = 2) };
//s = { f = 1.0 };
TestUnion tu = { e = TestStruct2 { c = 1 } };
tu.e = TestStruct2 { c = 1 };
@@ -168,6 +175,7 @@ func TestStruct2 structTest(int i)
TestStruct2 bar2 = { b.a = x, a.a = x + 1 };
return bar2;
}
func void enumInferenceTest()
{
OtherError e = OtherError.FOO_BAR;