From 1828e79412da864b0a02dfad2928150ed0750d1b Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 27 Sep 2022 15:36:06 +0300 Subject: [PATCH] compiler: add test for foreign function inlining --- pkg/compiler/inline_test.go | 10 ++++++++++ pkg/compiler/testdata/inline/inline.go | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/pkg/compiler/inline_test.go b/pkg/compiler/inline_test.go index 8a9dfdf24..b3c21bcfb 100644 --- a/pkg/compiler/inline_test.go +++ b/pkg/compiler/inline_test.go @@ -443,3 +443,13 @@ func TestInlineAppendStatement(t *testing.T) { }` eval(t, src, []byte{1, 2, 3, 4, 5, 6}) } + +func TestInlineForeignType(t *testing.T) { + src := `package foo + import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline" + + func Main() int { + return inline.ForeignTypeInsideInline() + }` + eval(t, src, big.NewInt(29)) +} diff --git a/pkg/compiler/testdata/inline/inline.go b/pkg/compiler/testdata/inline/inline.go index 4f56faa23..ba9cd2acd 100644 --- a/pkg/compiler/testdata/inline/inline.go +++ b/pkg/compiler/testdata/inline/inline.go @@ -69,3 +69,7 @@ func AppendInsideInline(val []byte) []byte { inlinedType := []byte{1, 2, 3} return append(inlinedType, val...) } + +func ForeignTypeInsideInline() int { + return a.GetA() +}