mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
New Singleton
enum for PatternMatchSingleton
node (#8063)
## Summary This PR adds a new `Singleton` enum for the `PatternMatchSingleton` node. Earlier the node was using the `Constant` enum but the value for this pattern can only be either `None`, `True` or `False`. With the coming PR to remove the `Constant`, this node required a new type to fill in. This also has the benefit of narrowing the type down to only the possible values for the node as evident by the removal of `unreachable`. ## Test Plan Update the AST snapshots and run `cargo test`.
This commit is contained in:
parent
ee7d445ef5
commit
78bbf6d403
10 changed files with 70 additions and 28 deletions
|
@ -719,9 +719,7 @@ expression: parse_ast
|
|||
MatchSingleton(
|
||||
PatternMatchSingleton {
|
||||
range: 621..625,
|
||||
value: Bool(
|
||||
true,
|
||||
),
|
||||
value: True,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
@ -2402,9 +2400,7 @@ expression: parse_ast
|
|||
pattern: MatchSingleton(
|
||||
PatternMatchSingleton {
|
||||
range: 1947..1952,
|
||||
value: Bool(
|
||||
false,
|
||||
),
|
||||
value: False,
|
||||
},
|
||||
),
|
||||
guard: None,
|
||||
|
@ -3051,9 +3047,7 @@ expression: parse_ast
|
|||
MatchSingleton(
|
||||
PatternMatchSingleton {
|
||||
range: 2405..2410,
|
||||
value: Bool(
|
||||
false,
|
||||
),
|
||||
value: False,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue