vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.83k stars 789 forks source link

fix[lang]: typecheck hashmap indexes with folding #4007

Closed DanielSchiavini closed 3 months ago

DanielSchiavini commented 3 months ago

Fixes #3984

What I did

How I did it

How to verify it

Commit message

this commit fixes a bug in typechecking of folded values for hashmap
indexes. there was previously a carveout for subscript typechecking for
arrays; however, it should not apply to hashmap indexes.

this was introduced as an edge case resulting from the semantic changes
in 56c4c9dbc0. a related fix was applied in 75fb0594ab3, but it did not
handle hashmaps.

Description for the changelog

HashMap index is checked when the subscript is folded

Cute Animal Picture

image

Leminkay commented 3 months ago

LGTM!

charles-cooper commented 3 months ago

@DanielSchiavini update the commit message please with a description of how the change was arrived at, and i'll merge

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 47.96%. Comparing base (4c66c8c) to head (93d1bb7).

:exclamation: Current head 93d1bb7 differs from pull request most recent head 19e927a. Consider uploading reports for the commit 19e927a to get more accurate results

Files Patch % Lines
vyper/semantics/analysis/local.py 0.00% 4 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4007 +/- ## =========================================== - Coverage 90.90% 47.96% -42.94% =========================================== Files 105 105 Lines 15246 15247 +1 Branches 3358 3358 =========================================== - Hits 13859 7313 -6546 - Misses 952 7326 +6374 - Partials 435 608 +173 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.