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

pass nil to interface method get runtime error "Call using interface {} as type *int (1:5)" #688

Open
wodeqiangne opened this issue Jul 23, 2024 · 0 comments
Labels

Comments

@wodeqiangne
Copy link

wodeqiangne commented Jul 23, 2024

`type Foo interface {
Add(a int, b *int)
}

type FooImpl struct {
}

func (*FooImpl) Add(a int, b *int) {
return
}

func TestNoInterfaceMethodWithNil(t *testing.T) {

var m = map[string]any{
	"foo": &FooImpl{},
}

program, err := expr.Compile(`foo.Add(1, nil)`)
require.NoError(t, err)

_, err = expr.Run(program, m)
require.NoError(t, err)

}
`

return with error Call using interface {} as type *int (1:5)

@wodeqiangne wodeqiangne changed the title pass nil to interface method get runtime error pass nil to interface method get runtime error "Call using interface {} as type *int (1:5)" Jul 23, 2024
@antonmedv antonmedv added the bug label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants