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

Bugfix: Propagate RHS type of resolved assignments #1569

Merged

Conversation

xermicus
Copy link
Contributor

@xermicus xermicus commented Oct 17, 2023

When resolving an assignment, the resolved variable should inherit the RHS type to avoid various issues in later compilation stages (for example with assignment chains).

…ry and cant be of type StorageRef. Not dereferencing the type causes various issues in later compilation stages.

Signed-off-by: xermicus <cyrill@parity.io>
@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #1569 (b6ba9df) into main (242ebfd) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

❗ Current head b6ba9df differs from pull request most recent head 65b71bd. Consider uploading reports for the commit 65b71bd to get more accurate results

@@            Coverage Diff             @@
##             main    #1569      +/-   ##
==========================================
- Coverage   87.41%   87.34%   -0.08%     
==========================================
  Files         133      133              
  Lines       64133    64148      +15     
==========================================
- Hits        56063    56029      -34     
- Misses       8070     8119      +49     
Files Coverage Δ
src/codegen/expression.rs 95.28% <100.00%> (ø)
src/sema/types.rs 95.20% <100.00%> (+0.01%) ⬆️

... and 9 files with indirect coverage changes

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
@xermicus xermicus changed the title Bugfix: The type of a resolved assignments needs a storage deref Bugfix: Propagate RHS type of resolved assignments Oct 20, 2023
@xermicus
Copy link
Contributor Author

I changed the fix to use the RHS type of the assignment. Which seems to fix a bunch of cases (see codegen tests).

The FIXME added to the constant folding codegen test should go away after #1450. Unless there is easy fix for this, I think it deserves a dedicated fix (in the sense of a unused variable pass after codegen / until it converges). Otherwise the problem might only be partially fixed.

src/sema/types.rs Outdated Show resolved Hide resolved
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
@xermicus xermicus merged commit fd1b874 into hyperledger-solang:main Oct 23, 2023
16 of 17 checks passed
@xermicus xermicus deleted the bugfix-assignment-variable-type branch October 23, 2023 13:23
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.

3 participants