mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:39:12 +00:00
Skip over parentheses when detecting in
keyword (#8054)
## Summary Given an expression like `[x for (x) in y]`, we weren't skipping over parentheses when searching for the `in` between `(x)` and `y`. Closes https://github.com/astral-sh/ruff/issues/8053.
This commit is contained in:
parent
b2d1fcf7b2
commit
2729c4cacd
3 changed files with 17 additions and 20 deletions
|
@ -108,6 +108,9 @@ aaaaaaaaaaaaaaaaaaaaa = [
|
|||
c # negative decimal
|
||||
]
|
||||
|
||||
# Parenthesized targets and iterators.
|
||||
[x for (x) in y]
|
||||
[x for x in (y)]
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -247,6 +250,10 @@ aaaaaaaaaaaaaaaaaaaaa = [
|
|||
for components in b # pylint: disable=undefined-loop-variable # integer 1 may only have decimal 01-09
|
||||
+ c # negative decimal
|
||||
]
|
||||
|
||||
# Parenthesized targets and iterators.
|
||||
[x for (x) in y]
|
||||
[x for x in (y)]
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue