-
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.
Disallow star pattern outside sequence pattern
- Loading branch information
1 parent
3727e03
commit 801539c
Showing
5 changed files
with
632 additions
and
19 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
crates/ruff_python_parser/resources/invalid/statements/match/star_pattern_usage.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,24 @@ | ||
# Star pattern is only allowed inside a sequence pattern | ||
match subject: | ||
case *_: | ||
pass | ||
case *_ as x: | ||
pass | ||
case *foo: | ||
pass | ||
case *foo | 1: | ||
pass | ||
case 1 | *foo: | ||
pass | ||
case Foo(*_): | ||
pass | ||
case Foo(x=*_): | ||
pass | ||
case {*_}: | ||
pass | ||
case {*_: 1}: | ||
pass | ||
case {None: *_}: | ||
pass | ||
case 1 + *_: | ||
pass |
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
Oops, something went wrong.