mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Reset FOR_TARGET
context for all kinds of parentheses (#11009)
## Summary This PR fixes a bug in the new parser which involves the parser context w.r.t. for statement. This is specifically around the `in` keyword which can be present in the target expression and shouldn't be considered to be part of the `for` statement header. Ideally it should use a context which is passed between functions, thus using a call stack to set / unset a specific variant which will be done in a follow-up PR as it requires some amount of refactor. ## Test Plan Add test cases and update the snapshots.
This commit is contained in:
parent
13ffb5bc19
commit
8020d486f6
7 changed files with 445 additions and 27 deletions
|
@ -0,0 +1 @@
|
|||
for d(x in y) in target: ...
|
|
@ -1,2 +1,5 @@
|
|||
for (x in y)() in iter: ...
|
||||
for (x in y) in iter: ...
|
||||
for (x in y, z) in iter: ...
|
||||
for [x in y, z] in iter: ...
|
||||
for {x in y, z} in iter: ...
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
for d[x in y] in target: ...
|
Loading…
Add table
Add a link
Reference in a new issue