-
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
fix(gnovm): improve error message for nil assignment in variable decl… #3068
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3068 +/- ##
=======================================
Coverage 63.33% 63.34%
=======================================
Files 548 548
Lines 78599 78599
=======================================
+ Hits 49784 49791 +7
+ Misses 25461 25454 -7
Partials 3354 3354
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
f8443e5
to
a67d677
Compare
gnovm/tests/files/assign29.gno
Outdated
} | ||
|
||
// Error: | ||
// main/files/assign29.gno:5:2: cannot use nil as int value in variable declaration |
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.
should be cannot use nil as int value in assignment
gnovm/pkg/gnolang/type_check.go
Outdated
@@ -289,7 +289,7 @@ func checkAssignableTo(xt, dt Type, autoNative bool) error { | |||
// case0 | |||
if xt == nil { // see test/files/types/eql_0f18 | |||
if !maybeNil(dt) { | |||
panic(fmt.Sprintf("invalid operation, nil can not be compared to %v", dt)) | |||
panic(fmt.Sprintf("cannot use nil as %v value in variable declaration", dt)) |
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.
thank you for tackling this.
can you add some more tests like |
3cec7e2
to
5b171a4
Compare
5b171a4
to
6be8a9a
Compare
…aration
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description