diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index 1d56a2e2c..70e7592da 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -1819,7 +1819,7 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) { emit.Opcodes(c.prog.BinWriter, opcode.DROP, opcode.PUSH0) case "append": arg := expr.Args[0] - typ := c.typeInfo.Types[arg].Type + typ := c.typeOf(arg) ast.Walk(c, arg) emit.Opcodes(c.prog.BinWriter, opcode.DUP, opcode.ISNULL) if isByteSlice(typ) { diff --git a/pkg/compiler/inline_test.go b/pkg/compiler/inline_test.go index 9b217fa44..8a9dfdf24 100644 --- a/pkg/compiler/inline_test.go +++ b/pkg/compiler/inline_test.go @@ -432,3 +432,14 @@ func TestInlineDoubleConditionalReturn(t *testing.T) { }) } } + +func TestInlineAppendStatement(t *testing.T) { + src := `package foo + import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline" + + func Main() []byte { + val := []byte{4, 5, 6} + return inline.AppendInsideInline(val) + }` + eval(t, src, []byte{1, 2, 3, 4, 5, 6}) +} diff --git a/pkg/compiler/testdata/inline/inline.go b/pkg/compiler/testdata/inline/inline.go index 80a7041d9..4f56faa23 100644 --- a/pkg/compiler/testdata/inline/inline.go +++ b/pkg/compiler/testdata/inline/inline.go @@ -64,3 +64,8 @@ func NewT() T { func (t T) GetN() int { return t.N } + +func AppendInsideInline(val []byte) []byte { + inlinedType := []byte{1, 2, 3} + return append(inlinedType, val...) +}