Skip to content

Commit a017ea5

Browse files
committed
test: add unit test for capture pattern narrowing
1 parent b23b85b commit a017ea5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-data/unit/check-python310.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ match m:
88
case a:
99
reveal_type(a) # N: Revealed type is "__main__.A"
1010

11+
[case testMatchCapturePatternNarrows]
12+
x: int | None
13+
y: int
14+
15+
match x:
16+
case None:
17+
pass
18+
case y:
19+
reveal_type(y) # N: Revealed type is "builtins.int"
20+
1121
-- Literal Pattern --
1222

1323
[case testMatchLiteralPatternNarrows]

0 commit comments

Comments
 (0)