compiler: check for NULL when calculating len(), fix #1153
This commit is contained in:
parent
b3e450477d
commit
ebe37d1a46
2 changed files with 19 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue