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

allow variable access on constant/literal arrays #2534

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Nov 10, 2021

What I did

Fix #2156 and #2130

Note that a bug similar to #2130 can still be triggered with a list of ambiguous type. For instance, MY_LIST: constant(uint256[1]) = [1]. I used a decimal in the test to demonstrate that the array literals pass but the type checker issue still needs to be addressed.

How I did it

Expand the logic in Expr.parse_Subscript to handle constants/literals

How to verify it

See test

Description for the changelog

Allow variable access on constant/literal arrays

Cute Animal Picture

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

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

Merging #2534 (d101640) into master (9a5dd50) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2534      +/-   ##
==========================================
+ Coverage   84.67%   84.74%   +0.06%     
==========================================
  Files          93       93              
  Lines        9301     9309       +8     
  Branches     2096     2097       +1     
==========================================
+ Hits         7876     7889      +13     
+ Misses        940      937       -3     
+ Partials      485      483       -2     
Impacted Files Coverage Δ
vyper/old_codegen/expr.py 80.00% <100.00%> (+0.12%) ⬆️
vyper/old_codegen/external_call.py 94.33% <0.00%> (ø)
vyper/old_codegen/parser_utils.py 83.01% <0.00%> (+0.23%) ⬆️
vyper/builtin_functions/functions.py 88.96% <0.00%> (+0.33%) ⬆️
vyper/ast/nodes.py 93.95% <0.00%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a5dd50...d101640. Read the comment docs.

@charles-cooper charles-cooper merged commit 55ec927 into vyperlang:master Nov 11, 2021
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.

Constant arrays cannot be indexed with variables
3 participants