Skip to content

fix: type checking in for loops#2096

Merged
iamdefinitelyahuman merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:fix-type-checking-for-loops
Jul 5, 2020
Merged

fix: type checking in for loops#2096
iamdefinitelyahuman merged 1 commit into
vyperlang:masterfrom
iamdefinitelyahuman:fix-type-checking-for-loops

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

  • Fix a bug in the type checker preventing proper checks during for loops. This wasn't a critical issue, as any failure is still caught in parser.
  • Improve how exception messages are handled during a failed type check in a for loop

How I did it

  • The main issue was from an improperly indented return. Ooops.
  • For the exception message, I'm tracking every exception raised during the iterative check. At the end, if they're all the same exception, I raise it instead of the more generic "could not determine type for i".

How to verify it

Run tests.

Cute Animal Picture

image

Comment thread vyper/context/validation/local.py Outdated

for_loop_exceptions = []
for type_ in type_list:
# type check the fdor loop body using each possible type for iterator value

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.

fdor lol

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fnord

@iamdefinitelyahuman iamdefinitelyahuman force-pushed the fix-type-checking-for-loops branch from c7c479e to b18438b Compare July 5, 2020 15:20
@iamdefinitelyahuman iamdefinitelyahuman merged commit 0e6141a into vyperlang:master Jul 5, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-type-checking-for-loops branch July 5, 2020 16:37
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.

2 participants