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

fix: assignment when rhs is complex type and references lhs #3410

Merged
merged 6 commits into from
May 15, 2023

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 14, 2023

What I did

fix #2418

How I did it

check that rhs and lhs do not overlap in parse_Assign. if they do, copy rhs to a temporary buffer, then copy to the lhs. this might not be the most efficient approach, but it is safe (and it's a relatively rare case to see in user code).

note that this doesn't touch make_setter directly because it would need access to the memory allocator (to allocate the temporary buffer). this would result in the fix not working in other cases where the arguments to make_setter overlap. i don't think there are any cases of those, but if there were, they would need to be fixed on a case by case basis.

How to verify it

test cases fail on master (97ff017) but pass on this branch.

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

codecov-commenter commented May 14, 2023

Codecov Report

Merging #3410 (71b36df) into master (97ff017) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3410      +/-   ##
==========================================
- Coverage   88.96%   88.89%   -0.07%     
==========================================
  Files          86       86              
  Lines       10765    10788      +23     
  Branches     2445     2448       +3     
==========================================
+ Hits         9577     9590      +13     
- Misses        786      796      +10     
  Partials      402      402              
Impacted Files Coverage Δ
vyper/codegen/context.py 91.91% <100.00%> (+0.12%) ⬆️
vyper/codegen/expr.py 87.67% <100.00%> (+0.17%) ⬆️
vyper/codegen/ir_node.py 91.24% <100.00%> (+0.21%) ⬆️
vyper/codegen/stmt.py 89.76% <100.00%> (+0.29%) ⬆️
vyper/semantics/analysis/base.py 81.50% <100.00%> (+0.25%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make_setter is incorrect for complex types when the RHS references the LHS
3 participants