compiler: check for NULL when calculating len(), fix #1153

This commit is contained in:
Roman Khimov 2020-07-07 21:49:21 +03:00
parent b3e450477d
commit ebe37d1a46
2 changed files with 19 additions and 1 deletions

View file

@ -187,3 +187,14 @@ func TestBuiltinPackage(t *testing.T) {
}`
eval(t, src, big.NewInt(1))
}
func TestLenForNil(t *testing.T) {
src := `
package foo
func Main() bool {
var a []int = nil
return len(a) == 0
}`
eval(t, src, true)
}