compiler: support nested struct fielid assignment

This commit is contained in:
Evgenii Stratonikov 2020-05-20 11:08:59 +03:00
parent 1e40f9dac0
commit 051e3608ff
2 changed files with 24 additions and 11 deletions

View file

@ -352,6 +352,22 @@ var structTestCases = []testCase{
}`,
big.NewInt(3),
},
{
"nested selectors (simple write)",
`package foo
type S1 struct { x S2 }
type S2 struct { a int }
func Main() int {
s1 := S1{
x: S2 {
a: 3,
},
}
s1.x.a = 11
return s1.x.a
}`,
big.NewInt(11),
},
}
func TestStructs(t *testing.T) {