compiler: allow to call methods on return values
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
aa338b7960
commit
e1a581be0e
5 changed files with 50 additions and 4 deletions
|
@ -11,6 +11,27 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestReturnValueReceiver(t *testing.T) {
|
||||
t.Run("regular", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/method"
|
||||
|
||||
func Main() int {
|
||||
return method.NewX().GetA()
|
||||
}`
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
t.Run("inline", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline"
|
||||
|
||||
func Main() int {
|
||||
return inline.NewT().GetN()
|
||||
}`
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSimpleFunctionCall(t *testing.T) {
|
||||
src := `
|
||||
package testcase
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue