Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile of method call on interface fails with "too many arguments to call Method (1:1)" #36

Closed
enijns opened this issue Jul 3, 2019 · 1 comment

Comments

@enijns
Copy link

enijns commented Jul 3, 2019

Using expr.Eval seems to work fine though.
I will also submit the following example as a pull request:

`type AnInterface interface {
Method(x string) []AnInterface
}

type A struct{ I int }

func (self A) Method(x string) []AnInterface {
return []AnInterface{self}
}

func ExampleCompileInterfaceMethodCall() {

type B_Env struct{ Ai AnInterface }

env := B_Env{A{6}}

prog, err := expr.Compile(`Ai.Method("x")`, expr.Env(env))

if err != nil {
	fmt.Printf("%v", err)
	return
}

output, err := expr.Run(prog, env)

if err != nil {
	fmt.Printf("%v", err)
	return
}

fmt.Printf("%v", output)

// Output: 6

}`

@antonmedv
Copy link
Member

Fixed in 9c096db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants