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.
This commit is contained in:
Roman Khimov 2021-04-05 23:03:10 +03:00
parent 21a7f3d760
commit 7e9f8e03c2

View file

@ -264,3 +264,13 @@ func TestInlineConversionQualified(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, b2, b1) 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))
}