compiler: allow to omit struct field names in literals
This commit is contained in:
parent
5a615d8178
commit
6ddaed3927
2 changed files with 24 additions and 0 deletions
|
@ -394,6 +394,17 @@ var structTestCases = []testCase{
|
|||
}`,
|
||||
big.NewInt(42),
|
||||
},
|
||||
{
|
||||
"omit field names",
|
||||
`package foo
|
||||
type pair struct { a, b int }
|
||||
func Main() int {
|
||||
p := pair{1, 2}
|
||||
x := p.a * 10
|
||||
return x + p.b
|
||||
}`,
|
||||
big.NewInt(12),
|
||||
},
|
||||
}
|
||||
|
||||
func TestStructs(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue