From 7e9f8e03c24d05fb9cca3188fe4ad7ecf7d826a2 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 5 Apr 2021 23:03:10 +0300 Subject: [PATCH] compiler: add a test for inlined selector statements Selector here is either a struct field access or global package variable/constant. While technically none of these require an additional local, inlining actually uses one, so add a test for it. --- pkg/compiler/inline_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/compiler/inline_test.go b/pkg/compiler/inline_test.go index 4c814cf26..bf62e65a3 100644 --- a/pkg/compiler/inline_test.go +++ b/pkg/compiler/inline_test.go @@ -264,3 +264,13 @@ func TestInlineConversionQualified(t *testing.T) { require.NoError(t, err) require.Equal(t, b2, b1) } + +func TestPackageVarsInInlinedCalls(t *testing.T) { + src := `package foo + import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline" + import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline/b" + func Main() int { + return inline.Sum(inline.A, b.A) + }` + eval(t, src, big.NewInt(13)) +}