fix: automatic type conversion for untyped arg of append (#177)
This commit is contained in:
committed by
Ludovic Fernandez
parent
5cdcf61e0e
commit
c6c7f8cea6
@@ -1406,7 +1406,11 @@ func _append(n *Node) {
|
||||
l := len(args)
|
||||
values := make([]func(*Frame) reflect.Value, l)
|
||||
for i, arg := range args {
|
||||
values[i] = genValue(arg)
|
||||
if arg.typ.untyped {
|
||||
values[i] = genValueAs(arg, n.child[1].typ.TypeOf().Elem())
|
||||
} else {
|
||||
values[i] = genValue(arg)
|
||||
}
|
||||
}
|
||||
|
||||
n.exec = func(f *Frame) Builtin {
|
||||
@@ -1419,6 +1423,9 @@ func _append(n *Node) {
|
||||
}
|
||||
} else {
|
||||
value0 := genValue(n.child[2])
|
||||
if n.child[2].typ.untyped {
|
||||
value0 = genValueAs(n.child[2], n.child[1].typ.TypeOf().Elem())
|
||||
}
|
||||
|
||||
n.exec = func(f *Frame) Builtin {
|
||||
dest(f).Set(reflect.Append(value(f), value0(f)))
|
||||
|
||||
Reference in New Issue
Block a user