interp: fix derivation of type of slice expression of binary object

Fixes #1328.
This commit is contained in:
Marc Vertes
2021-12-20 15:46:05 +01:00
committed by GitHub
parent 2af660cb1f
commit 2819b4167b
2 changed files with 24 additions and 0 deletions

View File

@@ -854,6 +854,14 @@ func nodeType2(interp *Interpreter, sc *scope, n *node, seen []*node) (t *itype,
if err != nil {
return nil, err
}
if t.cat == valueT {
switch t.rtype.Kind() {
case reflect.Array, reflect.Ptr:
t = valueTOf(reflect.SliceOf(t.rtype.Elem()), withScope(sc))
}
break
}
if t.cat == ptrT {
t = t.val
}