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

can break out of a self-executing closure #2973

Open
thehowl opened this issue Oct 17, 2024 · 1 comment
Open

can break out of a self-executing closure #2973

thehowl opened this issue Oct 17, 2024 · 1 comment
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@thehowl
Copy link
Member

thehowl commented Oct 17, 2024

In today's episode of "Wouldn't It Be Funny If This Actually Worked?"

package main

func main() {
	for i := 0; i < 10; i++ {
		if i == 1 {
			_ = func() int {
				break
				return 11
			}()
		}
		println(i)
	}
	println("wat???")
}

Of course, this code isn't meant to compile, but Gno's output is a simple and somewhat disarming:

0
wat???
@thehowl thehowl added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related labels Oct 17, 2024
@thehowl
Copy link
Member Author

thehowl commented Oct 17, 2024

This can likely work for continue and possibly also fallthrough, so a fix should verify the correct behaviour for all three statements.

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
Development

No branches or pull requests

2 participants