Skip to content

WIP: fix(gnovm): validate assignment targets in range, compound assign, and inc/dec#5804

Closed
ltzmaxwell wants to merge 23 commits into
gnolang:masterfrom
ltzmaxwell:fix/assign_range_f
Closed

WIP: fix(gnovm): validate assignment targets in range, compound assign, and inc/dec#5804
ltzmaxwell wants to merge 23 commits into
gnolang:masterfrom
ltzmaxwell:fix/assign_range_f

Conversation

@ltzmaxwell

@ltzmaxwell ltzmaxwell commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Depends on #5764 (stacked on its head; review the commits above the merge boundary).

  • assertValidAssignLhs was only called from the plain-= branches, so unassignable targets slipped through elsewhere: for _, c = range a with const c and c++ panicked at runtime, for k, nil = range m passed preprocess (nil static type aliases blank), and c += 1 / s[0] += 1 ran with the write silently discarded.
  • Fix: call assertValidAssignLhs on the non-blank range value operand, the compound-assign LHS, and the IncDecStmt operand — after the operator/type checks for the latter two, matching go/types error precedence (add_assign_a0, runtime_a3, shift_d44 goldens).
  • Tests: types/assign_range_f/g/h.gno (const and nil as range value), types/assign_op_a/b.gno (const +=, string-index +=), types/incdec_a5.gno (const ++).

@Gno2D2

Gno2D2 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: ltzmaxwell/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@ltzmaxwell ltzmaxwell changed the title WIP: fix(gnovm): reject unassignable range value operand in AssertCompatible WIP: fix(gnovm): validate assignment targets in range, compound assign, and inc/dec Jun 11, 2026
@ltzmaxwell

Copy link
Copy Markdown
Contributor Author

Folded into #5764 — the range key/value handling and target validation are one design; reviewing them together is more coherent. All commits from this branch are merged there.

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

Projects

Development

Successfully merging this pull request may close these issues.

2 participants