-
Notifications
You must be signed in to change notification settings - Fork 456
fix(gnovm): handle blank range key/value per-operand, validate assignment targets #5764
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
Open
ltzmaxwell
wants to merge
43
commits into
gnolang:master
Choose a base branch
from
ltzmaxwell:fix/range_blank_key
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
cd62122
test(gnovm): add range_blank_key filetest for nil-key range assertion
ltzmaxwell 72007ce
fix(gnovm): guard nil kt in assertIndexTypeIsInt for blank-key range
ltzmaxwell fa5c11d
chore(gnovm): tighten range_blank_key fix and filetest
ltzmaxwell 5ddcfbb
Merge remote-tracking branch 'origin/master' into fix/range_blank_key
ltzmaxwell 5e72fed
fix(gnovm): handle blank range key/value per-operand in AssertCompatible
ltzmaxwell c15e60b
refactor(gnovm): rely on blank-type convention in map range check, fl…
ltzmaxwell fadc5fa
refactor(gnovm): drop redundant vt nil guards in range type checks
ltzmaxwell af1d4ba
refactor(gnovm): hoist blank-target nil case to top of checkAssignableTo
ltzmaxwell 20da0c7
test(gnovm): add assign_range_f/g filetests (const as range value ope…
ltzmaxwell f2e16f1
fix(gnovm): reject unassignable range value operand in AssertCompatible
ltzmaxwell b77da58
test(gnovm): add assign_op_a/b and incdec_a5 filetests (unassignable …
ltzmaxwell f756434
fix(gnovm): validate assign target for compound assign and inc/dec st…
ltzmaxwell d56157a
test(gnovm): add assign_nil3 filetest (_ = nil must be rejected)
ltzmaxwell 6c58960
fix(gnovm): reject bare untyped nil assigned to blank identifier
ltzmaxwell 7c99b14
refactor(gnovm): require non-nil dt in checkAssignableTo, skip blank …
ltzmaxwell e331865
test(gnovm): add assign_range_h filetest (nil as range value operand)
ltzmaxwell dc75a8a
docs(gnovm): explain nil-dt ambiguity on checkAssignableTo panic
ltzmaxwell 8e4f7bc
Merge branch 'fix/range_blank_key' into fix/assign_range_f
ltzmaxwell 764d0b8
refactor(gnovm): panic explicitly on nil kt in assertIndexTypeIsInt
ltzmaxwell 61c7d56
Merge branch 'fix/range_blank_key' into fix/assign_range_f
ltzmaxwell 935a2dc
refactor(gnovm): ask assertValidAssignLhs for blank range key too, li…
ltzmaxwell b3e89b1
Merge branch 'fix/range_blank_key' into fix/assign_range_f
ltzmaxwell c8ff60e
refactor(gnovm): ask assertValidAssignLhs for blank range value too
ltzmaxwell 2b86b9f
refactor(gnovm): restructure range checks per-operand instead of per-…
ltzmaxwell bcf2d9f
Merge branch 'fix/assign_range_f' into fix/range_blank_key
ltzmaxwell 87c1804
refactor(gnovm): extract evalAssignLhsType helper for validity+type o…
ltzmaxwell e7347e3
refactor(gnovm): use evalAssignLhsType in remaining AssignStmt branches
ltzmaxwell 1e7d7df
test(gnovm): add assign_op_c filetest (blank as compound-assign target)
ltzmaxwell 248bd40
fix(gnovm): reject blank identifier as compound-assign target with pr…
ltzmaxwell e7a1197
refactor(gnovm): give IncDecStmt.AssertCompatible the assigning-state…
ltzmaxwell 542a673
test(gnovm): add assign_op_d/e/f filetests (invalid compound-assign RHS)
ltzmaxwell 0af1981
fix(gnovm): run assertValidAssignRhs for compound assignments too
ltzmaxwell c654faf
test(gnovm): add filetests for range/index ,ok over declared map types
ltzmaxwell 693898f
fix(gnovm): use baseOf in range and map-index ,ok operand checks for …
ltzmaxwell e1b2677
test(gnovm): add assign_range_j (named int range key); sync c/d goldens
ltzmaxwell eddaff3
fix(gnovm): check range index by assignability to int, not kind
ltzmaxwell e7ce39d
test(gnovm): add assign_range_k (named rune range value); sync e golden
ltzmaxwell 448ff33
fix(gnovm): check string range value by assignability to int32, not kind
ltzmaxwell 17ab57c
test(gnovm): add assign_op_g order pin (invalid RHS wins over unassig…
ltzmaxwell 96871b4
refactor(gnovm): fold identical slice/array value case in range check
ltzmaxwell 0c99046
test(gnovm): pin define from nil interface conversion (assign_nil4)
ltzmaxwell 5d5a459
docs(gnovm): clarify blank-nil rejection comment in assertValidAssignRhs
ltzmaxwell 0509a19
refactor(gnovm): only folded ConstExpr counts as bare nil; panic on u…
ltzmaxwell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package main | ||
|
|
||
| // Regression: `for _ = range slice` used to panic on nil key in assertIndexTypeIsInt. | ||
|
|
||
| func main() { | ||
| s := []int{1, 2, 3} | ||
| for _ = range s { | ||
| } | ||
| } | ||
|
|
||
| // Output: | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This also fix
Ref: #5751 (comment) (+ verified personally)