-
-
Notifications
You must be signed in to change notification settings - Fork 819
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
refactor: for loop target parsing #3724
refactor: for loop target parsing #3724
Conversation
use a parser trick to get always-correct source locations into for-loop target annotations.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #3724 +/- ##
==========================================
+ Coverage 84.11% 84.16% +0.05%
==========================================
Files 92 92
Lines 13123 13106 -17
Branches 2926 2922 -4
==========================================
- Hits 11038 11031 -7
+ Misses 1663 1656 -7
+ Partials 422 419 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is truly black magic.
I tried it with a nested error and it works too:
@external
def foo():
for i: DynArray[\
uint256, 3] in [[1], [2], [3]]:
for j: \
uint247 in i:
pass
vyper.exceptions.UnknownType: No builtin or user-defined type named 'uint247'. Did you mean 'uint24', or maybe 'uint240'?
contract "tmp/old_for3.vy:7", function "foo", line 7:12
6 for j: \
---> 7 uint247 in i:
-------------------^
8
it's somehow easier to navigate to it when it comes right before the definition of AnnotatingVisitor.
What I did
use a parser trick to get always-correct source locations into for-loop target annotations.
follow-up to #3721; reverts the AnnAssign pre-parser change from there.
How I did it
see commit
How to verify it
check new test will not pass without the parser changes.
Commit message
Description for the changelog
Cute Animal Picture