diff --git a/.gitignore b/.gitignore index 3a5347a1..1c088b81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .*.swo .*.swp *.dot +*.out .idea/ /yaegi internal/cmd/extract/extract diff --git a/_test/op10.go b/_test/op10.go new file mode 100644 index 00000000..5db58094 --- /dev/null +++ b/_test/op10.go @@ -0,0 +1,9 @@ +package main + +func main() { + _ = 1 + 1 + println("ok") +} + +// Output: +// ok diff --git a/_test/op11.go b/_test/op11.go new file mode 100644 index 00000000..ab2ecfa3 --- /dev/null +++ b/_test/op11.go @@ -0,0 +1,10 @@ +package main + +func main() { + a, b := 1, 2 + _ = a + b + println("ok") +} + +// Output: +// ok diff --git a/interp/type.go b/interp/type.go index 2e7c1ffc..b3220455 100644 --- a/interp/type.go +++ b/interp/type.go @@ -2393,7 +2393,7 @@ func isMap(t *itype) bool { return t.TypeOf().Kind() == reflect.Map } func isPtr(t *itype) bool { return t.TypeOf().Kind() == reflect.Ptr } func isEmptyInterface(t *itype) bool { - return t.cat == interfaceT && len(t.field) == 0 + return t != nil && t.cat == interfaceT && len(t.field) == 0 } func isGeneric(t *itype) bool {