mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Consider binary expr for parenthesized with items parsing (#11012)
## Summary This PR fixes the bug in with items parsing where it would fail to recognize that the parenthesized expression is part of a large binary expression. ## Test Plan Add test cases and verified the snapshots.
This commit is contained in:
parent
6c4d779140
commit
b7066e64e7
4 changed files with 417 additions and 9 deletions
|
@ -0,0 +1,10 @@
|
|||
# It doesn't matter what's inside the parentheses, these tests need to make sure
|
||||
# all binary expressions parses correctly.
|
||||
with (a) and b: ...
|
||||
with (a) is not b: ...
|
||||
# Make sure precedence works
|
||||
with (a) or b and c: ...
|
||||
with (a) and b or c: ...
|
||||
with (a | b) << c | d: ...
|
||||
# Postfix should still be parsed first
|
||||
with (a)[0] + b * c: ...
|
Loading…
Add table
Add a link
Reference in a new issue