-
Notifications
You must be signed in to change notification settings - Fork 375
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
[gnovm] chain Panics #756
Comments
I noticed that and it was on my TODO list :) About the examples in the golang nuts forum, I noticed this one, is it the one you're talking about ? func f1() (success bool) {
defer func() { success = recover() == nil }()
defer f2()
panic("panicking")
}
func f2() {
defer func() { _ = recover() }()
}
func f3() { _ = recover() }
|
The first post from Rob had a few examples. But we should run that too and others to verify the problem and test the solution! |
Thanks I'll work on that! |
Somehow unrelated with the TODO, but in Rob's examples I found something that isn't supported in Gno : https://go.dev/play/p/CcMGgY606O- Basically a |
- Add 2 challenges for map and slice literals, as described in gnolang#758 - Add a challenge to handle chained panics, as described in gnolang#756 - Add a challenge to handle a specific rule of recover, as described in this [comment][0] If you manage to solve one of these challenges by updating the gnovm code, move those files into the `gnovm/test/files` folder (eventually increment the number suffix in the name according to existing files). [0]: gnolang#756 (comment)
- Add 2 challenges for map and slice literals, as described in gnolang#758 - Add a challenge to handle chained panics, as described in gnolang#756 - Add a challenge to handle a specific rule of recover, as described in this [comment][0] If you manage to solve one of these challenges by updating the gnovm code, move those files into the `gnovm/test/files` folder (eventually increment the number suffix in the name according to existing files). [0]: gnolang#756 (comment)
- Add 2 challenges for map and slice literals, as described in gnolang#758 - Add a challenge to handle chained panics, as described in gnolang#756 - Add a challenge to handle a specific rule of recover, as described in this [comment][0] Also add some working recover cases in `tests/files`, to increase code coverage. If you manage to solve one of these challenges by updating the gnovm code, move those files into the `gnovm/test/files` folder (eventually increment the number suffix in the name according to existing files). [0]: gnolang#756 (comment)
Close gnolang#756 By turning m.Exception into a slice, it became possible to append exceptions when panics are chained. `recover` is adapted so it receives only the last panic, just as in go (see `tests/files/recover7.gno`). The remaining exception are then wiped. If no recover is met, the exceptions slice is formatted like in go, with exception concatened with `\n\t` (see `tests/files/panic0b.gno` that was prevouisly in `tests/challenges`).
Close gnolang#756 By turning m.Exception into a slice, it became possible to append exceptions when panics are chained. `recover` is adapted so it receives only the last panic, just as in go (see `tests/files/recover7.gno`). The remaining exception are then wiped. If no recover is met, the exceptions slice is formatted like in go, with exception concatened with `\n\t` (see `tests/files/panic0b.gno` that was prevouisly in `tests/challenges`).
Description
I don't think the current machine.Panic() handles recursive panics as it should.
vs https://groups.google.com/g/golang-nuts/c/HOXNBQu5c-Q/m/ltQ-QHBrw9gJ
The golang nuts link includes examples that should be added to our filetests, and failure there will prove this issue.
Recommend discussing spec before implementation for feedback!
The text was updated successfully, but these errors were encountered: