-
Notifications
You must be signed in to change notification settings - Fork 387
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
fix(gnovm): forbid star expression when value is not a pointer #2984
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2984 +/- ##
=======================================
Coverage 63.08% 63.08%
=======================================
Files 563 563
Lines 79254 79258 +4
=======================================
+ Hits 49998 50001 +3
+ Misses 25896 25895 -1
- Partials 3360 3362 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It looks fine to me. However, I found that for the following case, the error message slightly differs from what Go outputs: package main
const VALUE = 5
func main() {
println(*VALUE)
} When this code is executed in Go, it produces the following error message:
However, when run this code in gno, you can see
I think it would be helpful for debugging if it were made to output the constant's name like Go does. Additionally, if you declare it with package main
var VALUE = 5
func main() {
println(*VALUE)
}
// Output: panic: invalid operation: cannot indirect VALUE<VPBlock(3,0)> (variable of type int) [recovered] |
@notJoon |
Thanks for response. it seems reasonable to me. So I'll remove the triage-pending flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
case *StarExpr: | ||
xt := evalStaticTypeOf(store, last, n.X) | ||
if xt.Kind() != PointerKind && xt.Kind() != TypeKind { | ||
panic(fmt.Sprintf("invalid operation: cannot indirect %s (variable of type %s)", n.X.String(), xt.String())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always ahead of the game :) should have let you take a look first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch. Missed this one ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did a fix here: #3053
closes: #1088
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description