Skip to content

[Compiler] Check resource loss in assignments #3988

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented May 30, 2025

Work towards #3976

Description

Force assignment is also treated as any other assignment. At runtime, all assignments must check for resource-loss. Index assignment, and field assignment already has this check (comping from the interpreter). So the only change needed was to do the same check in local variable assignments (i.e: SetLocal).


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@SupunS SupunS self-assigned this May 30, 2025
@SupunS SupunS added the Feature label May 30, 2025
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:feature/compiler commit c3dbf57
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

@SupunS SupunS marked this pull request as ready for review June 2, 2025 14:46
@SupunS SupunS requested a review from turbolent as a code owner June 2, 2025 14:46
@SupunS SupunS requested a review from RZhang05 June 2, 2025 14:46
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great work! 👏

@SupunS SupunS merged commit c16dfa8 into feature/compiler Jun 2, 2025
8 of 9 checks passed
@SupunS SupunS deleted the supun/force-assignment branch June 2, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants