Skip to content

Array index typecheck#2108

Merged
fubuloubu merged 5 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-array-index-typecheck
Jul 16, 2020
Merged

Array index typecheck#2108
fubuloubu merged 5 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-array-index-typecheck

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

  • Fix a missing type check on array index values.
  • Add __repr__ to abstract types to improve readability of error messages.

How I did it

When an index value is not a literal integer, call to validate_expected_type and expect IntegerAbstractType

How to verify it

Run tests.

Cute Animal Picture

image

@fubuloubu

Copy link
Copy Markdown
Contributor

Add a test

@lgtm-com

lgtm-com Bot commented Jul 15, 2020

Copy link
Copy Markdown
Contributor

This pull request introduces 1 alert when merging 431bde4 into d585a4c - view on LGTM.com

new alerts:

  • 1 for Conflicting attributes in base classes

@iamdefinitelyahuman iamdefinitelyahuman force-pushed the fix-array-index-typecheck branch from 431bde4 to f6d8513 Compare July 16, 2020 16:15
@lgtm-com

lgtm-com Bot commented Jul 16, 2020

Copy link
Copy Markdown
Contributor

This pull request introduces 1 alert when merging f6d8513 into d585a4c - view on LGTM.com

new alerts:

  • 1 for Conflicting attributes in base classes

Comment thread vyper/context/types/abstract.py Outdated
Comment thread vyper/context/types/indexable/sequence.py
balajipachai and others added 5 commits July 16, 2020 20:53
After following the doc and executing brownie test, I faced an error: E       brownie.exceptions.EventLookupError: Unknown key '_value' - the 'DataChange' event includes these keys: setter, value

The error is quite explanatory, the event DataChange has been defined with keys `value` and `setter` and were being accessed in the test cases by `_value` and `_setter`.
Thus the proposed change
@iamdefinitelyahuman iamdefinitelyahuman force-pushed the fix-array-index-typecheck branch from f6d8513 to 24b7a3d Compare July 16, 2020 17:53
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #2108 into master will decrease coverage by 0.90%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2108      +/-   ##
==========================================
- Coverage   85.02%   84.12%   -0.91%     
==========================================
  Files          83       83              
  Lines        8261     8276      +15     
  Branches     1992     1994       +2     
==========================================
- Hits         7024     6962      -62     
- Misses        740      816      +76     
- Partials      497      498       +1     
Impacted Files Coverage Δ
vyper/context/types/indexable/sequence.py 84.61% <75.00%> (+0.61%) ⬆️
vyper/context/types/abstract.py 100.00% <100.00%> (ø)
vyper/context/validation/utils.py 91.80% <100.00%> (+0.13%) ⬆️
vyper/context/types/value/numeric.py 78.04% <0.00%> (-6.10%) ⬇️
vyper/functions/functions.py 84.37% <0.00%> (-5.35%) ⬇️
vyper/parser/expr.py 71.78% <0.00%> (-4.98%) ⬇️
vyper/ast/nodes.py 92.06% <0.00%> (-1.59%) ⬇️

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 fe474a9...24b7a3d. Read the comment docs.

@lgtm-com

lgtm-com Bot commented Jul 16, 2020

Copy link
Copy Markdown
Contributor

This pull request introduces 1 alert when merging 24b7a3d into 71568de - view on LGTM.com

new alerts:

  • 1 for Conflicting attributes in base classes

@fubuloubu fubuloubu merged commit dc8ebc0 into vyperlang:master Jul 16, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-array-index-typecheck branch July 16, 2020 20:28
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.

4 participants