Skip to content

Fix: invalid AnnAssign exception#2176

Merged
iamdefinitelyahuman merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-annassign
Sep 30, 2020
Merged

Fix: invalid AnnAssign exception#2176
iamdefinitelyahuman merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-annassign

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

Correctly handle an invalid AnnAssign during function-scoped type checking.

Fixes #2157

Cute Animal Picture

image

@codecov-commenter

codecov-commenter commented Sep 30, 2020

Copy link
Copy Markdown

Codecov Report

Merging #2176 into master will decrease coverage by 0.86%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2176      +/-   ##
==========================================
- Coverage   85.27%   84.41%   -0.87%     
==========================================
  Files          83       83              
  Lines        8400     8403       +3     
  Branches     2031     2032       +1     
==========================================
- Hits         7163     7093      -70     
- Misses        733      807      +74     
+ Partials      504      503       -1     
Impacted Files Coverage Δ
vyper/context/validation/local.py 88.38% <100.00%> (+0.14%) ⬆️
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 72.13% <0.00%> (-4.92%) ⬇️
vyper/ast/nodes.py 92.30% <0.00%> (-1.54%) ⬇️
vyper/context/validation/module.py 87.42% <0.00%> (+1.19%) ⬆️
vyper/ast/folding.py 93.61% <0.00%> (+2.12%) ⬆️

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 928ba7f...0d6815b. Read the comment docs.

def visit_AnnAssign(self, node):
name = node.get("target.id")
if name is None:
raise VariableDeclarationException("Invalid assignment", node)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for this?

@iamdefinitelyahuman iamdefinitelyahuman merged commit 15d8f4a into vyperlang:master Sep 30, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-annassign branch September 30, 2020 01: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.

Bad exception message when using attribute in AnnAssign

3 participants