compiler: optimize new empty struct creation with PACKSTRUCT

This commit is contained in:
Roman Khimov 2021-11-12 16:35:30 +03:00
parent 909ea477f4
commit a8befeea33
2 changed files with 13 additions and 6 deletions

View file

@ -394,6 +394,16 @@ var structTestCases = []testCase{
}`,
big.NewInt(11),
},
{
"lengthy struct default value",
`package foo
type S struct { x int; y []byte; z bool }
func Main() int {
var s S
return s.x
}`,
big.NewInt(0),
},
{
"nested selectors (complex write)",
`package foo