-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix long case blocks not split into multiple lines (#4024)
Co-authored-by: Jelle Zijlstra <[email protected]>
- Loading branch information
1 parent
46be1f8
commit 50ed622
Showing
6 changed files
with
101 additions
and
21 deletions.
There are no files selected for viewing
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
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
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,34 @@ | ||
# flags: --preview --minimum-version=3.10 | ||
match x: | ||
case "abcd" | "abcd" | "abcd" : | ||
pass | ||
case "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd": | ||
pass | ||
case xxxxxxxxxxxxxxxxxxxxxxx: | ||
pass | ||
|
||
# output | ||
|
||
match x: | ||
case "abcd" | "abcd" | "abcd": | ||
pass | ||
case ( | ||
"abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
| "abcd" | ||
): | ||
pass | ||
case xxxxxxxxxxxxxxxxxxxxxxx: | ||
pass |
39 changes: 39 additions & 0 deletions
39
tests/data/cases/preview_pattern_matching_trailing_comma.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,39 @@ | ||
# flags: --preview --minimum-version=3.10 | ||
match maybe, multiple: | ||
case perhaps, 5: | ||
pass | ||
case perhaps, 6,: | ||
pass | ||
|
||
|
||
match more := (than, one), indeed,: | ||
case _, (5, 6): | ||
pass | ||
case [[5], (6)], [7],: | ||
pass | ||
case _: | ||
pass | ||
|
||
|
||
# output | ||
|
||
match maybe, multiple: | ||
case perhaps, 5: | ||
pass | ||
case ( | ||
perhaps, | ||
6, | ||
): | ||
pass | ||
|
||
|
||
match more := (than, one), indeed,: | ||
case _, (5, 6): | ||
pass | ||
case ( | ||
[[5], (6)], | ||
[7], | ||
): | ||
pass | ||
case _: | ||
pass |