fix: variadic interface conversion in call/callBin

This commit is contained in:
Nicholas Wiersma
2020-07-02 23:55:03 +02:00
committed by GitHub
parent 1f514e63a8
commit 097a745e72
2 changed files with 23 additions and 8 deletions

View File

@@ -801,17 +801,18 @@ func call(n *node) {
values = append(values, func(f *frame) reflect.Value { return f.data[ind] })
}
default:
var arg *itype
if variadic >= 0 && i >= variadic {
arg = n.child[0].typ.arg[variadic].val
} else {
arg = n.child[0].typ.arg[i]
}
if c.kind == basicLit || c.rval.IsValid() {
var argType reflect.Type
if variadic >= 0 && i >= variadic {
argType = n.child[0].typ.arg[variadic].val.TypeOf()
} else {
argType = n.child[0].typ.arg[i].TypeOf()
}
argType := arg.TypeOf()
convertLiteralValue(c, argType)
}
switch {
case len(n.child[0].typ.arg) > i && n.child[0].typ.arg[i].cat == interfaceT:
case arg.cat == interfaceT:
values = append(values, genValueInterface(c))
case isRecursiveType(c.typ, c.typ.rtype):
values = append(values, genValueRecursiveInterfacePtrValue(c))
@@ -1072,7 +1073,7 @@ func callBin(n *node) {
values = append(values, genFunctionWrapper(c))
case interfaceT:
values = append(values, genValueInterfaceValue(c))
case arrayT:
case arrayT, variadicT:
switch c.typ.val.cat {
case interfaceT:
values = append(values, genValueInterfaceArray(c))