diff --git a/pkg/compiler/codegen.go b/pkg/compiler/codegen.go index 693bd7efd..937e52bf4 100644 --- a/pkg/compiler/codegen.go +++ b/pkg/compiler/codegen.go @@ -2067,7 +2067,11 @@ func (c *codegen) getFuncNameFromSelector(e *ast.SelectorExpr) (string, bool) { ident := e.X.(*ast.Ident) if c.typeInfo.Selections[e] != nil { typ := c.typeInfo.Types[ident].Type.String() - return c.getIdentName(typ, e.Sel.Name), true + name := c.getIdentName(typ, e.Sel.Name) + if name[0] == '*' { + name = name[1:] + } + return name, true } return c.getIdentName(ident.Name, e.Sel.Name), false } diff --git a/pkg/compiler/inline_test.go b/pkg/compiler/inline_test.go index d8734ebd9..b68a816d3 100644 --- a/pkg/compiler/inline_test.go +++ b/pkg/compiler/inline_test.go @@ -355,3 +355,22 @@ func TestInlinedMethod(t *testing.T) { }` eval(t, src, big.NewInt(100542)) } + +func TestInlinedMethodWithPointer(t *testing.T) { + src := `package foo + import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline" + func Main() int { + // It's important for this variable to not be named 't'. + var z = &inline.T{} + i := z.Inc(42) + if i != 0 || z.N != 42 { + return 0 + } + i = z.Inc(100500) + if i != 42 { + return 0 + } + return z.N + }` + eval(t, src, big.NewInt(100542)) +}