fix: handle empty interface conversion

This commit is contained in:
Nicholas Wiersma
2020-05-29 13:58:04 +02:00
committed by GitHub
parent 56d88ef89d
commit 3c88542180
2 changed files with 13 additions and 1 deletions

12
_test/interface42.go Normal file
View File

@@ -0,0 +1,12 @@
package main
import "fmt"
func main() {
v := interface{}(0)
fmt.Println(v)
}
// Output:
// 0

View File

@@ -383,7 +383,7 @@ func (interp *Interpreter) cfg(root *node, pkgID string) ([]*node, error) {
}
}
case arrayType, basicLit, chanType, funcType, mapType, structType:
case arrayType, basicLit, chanType, funcType, interfaceType, mapType, structType:
n.typ, err = nodeType(interp, sc, n)
return false
}