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

invalid type casting on interface #3768

Open
ltzmaxwell opened this issue Feb 17, 2025 · 0 comments
Open

invalid type casting on interface #3768

ltzmaxwell opened this issue Feb 17, 2025 · 0 comments
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@ltzmaxwell
Copy link
Contributor

Description

the code should produce the following error: ./prog.go:14:18: cannot convert a (variable of interface type Runner) to type Swimmer: Runner does not implement Swimmer (missing method Swim)

But it works fine in Gno.

package main

type Runner interface {
	Run()
}

type Swimmer interface {
	Swim()
}

func main() {
	a := Runner(nil)
	println(interface{}(a))
	println(Swimmer(a))
}

Output:
undefined
undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Triage
Development

No branches or pull requests

3 participants