fix(gnovm): Improve Error Message in `evalStaticTypeOf` function
Description
Closes #1082
Enhanced the error message in evalStaticTypeOf function to match with go's error message and provide more informative feeback.
Example of Errors
Sample code (taken from linked issue)
package main
func main() {
n := f()
}
func f() {
println("hello!")
}
Before
panic: evalStaticTypeOf() only supports *CallExpr with 1 result, got ()
After
panic: main/a.gno:3:1: f() (no value) used as value
Hint: Ensure the function returns a single value, or use multiple assignment
Go version (go playground)
./prog.go:4:2: declared and not used: n
./prog.go:4:7: f() (no value) used as value
Further Works
I think it would be good to fix getTypeOf function as well, but I can't think of a case where it would cause panic.
Contributors' checklist...
- [X] Added new tests, or not needed, or not feasible
- [X] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
- [ ] Updated the official documentation or not needed
- [X] No breaking changes were made, or a
BREAKING CHANGE: xxxmessage was included in the description - [X] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to generated graphs, if any. More info here.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
@notJoon
Did you get a chance to see @ltzmaxwell's comments? 🙏
what is the status of this one?
what is the status of this one?
@ltzmaxwell dust off now. sorry for the delay 🙏
Closing this PR in favor of https://github.com/gnolang/gno/pull/3049 to avoid duplicate work