-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
6c4d779
commit b7066e6
Showing
4 changed files
with
417 additions
and
9 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
crates/ruff_python_parser/resources/inline/ok/ambiguous_lpar_with_items_binary_expr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.