fix: compositeSparse handles fields of interface kind

Fixes #776.
This commit is contained in:
Marc Vertes
2020-07-13 17:55:04 +02:00
committed by GitHub
parent 0a79069dfc
commit 5eecbe515b
3 changed files with 47 additions and 0 deletions

View File

@@ -2116,6 +2116,10 @@ func doCompositeSparse(n *node, hasType bool) {
switch {
case c1.typ.cat == funcT:
values[field] = genFunctionWrapper(c1)
case c1.typ.cat == interfaceT:
values[field] = genValueInterfaceValue(c1)
case isArray(c1.typ) && c1.typ.val != nil && c1.typ.val.cat == interfaceT:
values[field] = genValueInterfaceArray(c1)
case isRecursiveType(n.typ.field[field].typ, n.typ.field[field].typ.rtype):
values[field] = genValueRecursiveInterface(c1, n.typ.field[field].typ.rtype)
default: