fix: handle nil interface conversion

This commit is contained in:
Nicholas Wiersma
2020-06-03 00:32:04 +02:00
committed by GitHub
parent 01e4cdea70
commit d5217f7db4
2 changed files with 15 additions and 0 deletions

View File

@@ -225,6 +225,9 @@ func convert(n *node) {
next := getExec(n.tnext)
if c.isNil() { // convert nil to type
if n.child[0].typ.cat == interfaceT {
typ = reflect.TypeOf((*valueInterface)(nil)).Elem()
}
n.exec = func(f *frame) bltn {
dest(f).Set(reflect.New(typ).Elem())
return next