-
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
feat(gnovm): sync code AssignStmt - ValueDecl #3017
base: master
Are you sure you want to change the base?
feat(gnovm): sync code AssignStmt - ValueDecl #3017
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3017 +/- ##
==========================================
- Coverage 63.79% 63.27% -0.52%
==========================================
Files 549 548 -1
Lines 78819 78390 -429
==========================================
- Hits 50279 49598 -681
- Misses 25150 25441 +291
+ Partials 3390 3351 -39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Looks good to me 🔥
Co-authored-by: Mikael VALLENET <mikael.vallenetpro@gmail.com>
thanks @mvertes for your time and your reviews , I've addressed all your feedbacks. Please re-check the PR, please. Thanksssss. |
gnovm/pkg/gnolang/preprocess.go
Outdated
if len(n.Values) > 1 && len(n.NameExprs) != len(n.Values) { | ||
panic(fmt.Sprintf("assignment mismatch: %d variable(s) but %d value(s)", len(n.NameExprs), len(n.Values))) |
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.
Sorry my last request. What do you think about moving this check into the defineOrDecl
function?
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.
yeah I think it's good idea. Because it was done in AssertCompatible
for Define so it's kind of duplicated check but regroup all needed check in defineOrDecl
is OK I think
When handling assignStmt and valueDecl, there are two main tasks:
To unify the specifications for For example: package main
func main() {
var a int = "hello" // valueDecl
var a int
a = "hello" // assignStmt
} In this code, both valueDecl and assignStmt should follow the same logic during type checking to ensure compatibility(in type_check.go). To summarize, we should apply both AssertCompatible(step1) and defineOrDecl (step2) operations to handle what do you think? |
Related: #2695 |
Thanks for your review. I've checked the code, there is only one re-usable code in AssignStmt assertCompatible is:
Which is already handled in defineOrDecl. Other processings are mostly for Assign. I've tried to refactor to be able to share the code even more (refactor/reuse assertCompatible) but don't find any "happy/good" solution. Do you have any idea on that ? |
Removed the |
Hello @hthieu1110 . Many of the CI checks failed because of a misconfiguration. This has now been fixed. Can you please push an empty commit? This will make the CI checks run again and hopefully fix them. |
We're having issues with Codecov, ignore failed Codecov tests for now. |
This PR aims at fixing this issue 1958
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description