Skip to content
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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

hthieu1110
Copy link
Contributor

@hthieu1110 hthieu1110 commented Oct 24, 2024

This PR aims at fixing this issue 1958

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 6 lines in your changes missing coverage. Please review.

Project coverage is 63.31%. Comparing base (af05780) to head (c4398a2).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
gnovm/pkg/gnolang/preprocess.go 95.65% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3017      +/-   ##
==========================================
- Coverage   63.32%   63.31%   -0.01%     
==========================================
  Files         548      548              
  Lines       78511    78480      -31     
==========================================
- Hits        49719    49692      -27     
+ Misses      25438    25434       -4     
  Partials     3354     3354              
Flag Coverage Δ
contribs/gnodev 59.94% <ø> (-0.63%) ⬇️
contribs/gnofaucet 14.82% <ø> (ø)
gno.land 67.18% <ø> (ø)
gnovm 67.86% <95.65%> (-0.02%) ⬇️
misc/genstd 79.72% <ø> (ø)
tm2 62.42% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hthieu1110 hthieu1110 changed the title Feat/sync assignstmt valuedecl 1958 feat(gnovm) sync assignstmt - valuedecl Oct 25, 2024
@hthieu1110 hthieu1110 changed the title feat(gnovm) sync assignstmt - valuedecl feat(gnovm): sync assignstmt - valuedecl Oct 25, 2024
@hthieu1110 hthieu1110 changed the title feat(gnovm): sync assignstmt - valuedecl feat(gnovm): sync AssignStmt - ValueDecl Oct 25, 2024
@hthieu1110 hthieu1110 changed the title feat(gnovm): sync AssignStmt - ValueDecl feat(gnovm): sync code AssignStmt - ValueDecl Oct 25, 2024
Copy link
Contributor

@MikaelVallenet MikaelVallenet left a 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 🔥

gnovm/pkg/gnolang/preprocess.go Outdated Show resolved Hide resolved
nx.Path = last.GetPathForName(nil, nx.Name)
}
}
if len(n.Values) != 1 && len(n.Values) != 0 && len(n.NameExprs) != len(n.Values) {
Copy link
Member

@omarsy omarsy Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this len(n.Values) != 1 && len(n.Values) != 0 ?
I think this will not handle this case:

package main

var a, b = 1

func main() {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally, there were 3 cases:

if numNames > 1 && len(n.Values) == 1 {
...
} else if len(n.Values) != 0 && numNames != len(n.Values) { 
...
} else {
...
}

To be able to refactor the code, I've moved this check first then 2 others. So I've added the condition but it looks strange like that, I've pushed the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omarsy I've checked, actually the errors for var a, b = 1 vs a, b := 1 are identical with Golang

@hthieu1110 hthieu1110 marked this pull request as ready for review November 1, 2024 01:34
@jefft0 jefft0 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related review/triage-pending PRs opened by external contributors that are waiting for the 1st review
Projects
Status: No status
Status: Triage
Development

Successfully merging this pull request may close these issues.

4 participants