Skip to content

Commit 3579c61

Browse files
authored
Add test documenting #17230 (#17199)
1 parent e8a2630 commit 3579c61

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test-data/unit/check-python310.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,21 @@ def main() -> None:
12201220
case a:
12211221
reveal_type(a) # N: Revealed type is "builtins.int"
12221222

1223+
[case testMatchCapturePatternFromAsyncFunctionReturningUnion-xfail]
1224+
async def func1(arg: bool) -> str | int: ...
1225+
async def func2(arg: bool) -> bytes | int: ...
1226+
1227+
async def main() -> None:
1228+
match await func1(True):
1229+
case str(a):
1230+
match await func2(True):
1231+
case c:
1232+
reveal_type(a) # N: Revealed type is "builtins.str"
1233+
reveal_type(c) # N: Revealed type is "Union[builtins.bytes, builtins.int]"
1234+
reveal_type(a) # N: Revealed type is "builtins.str"
1235+
case a:
1236+
reveal_type(a) # N: Revealed type is "builtins.int"
1237+
12231238
-- Guards --
12241239

12251240
[case testMatchSimplePatternGuard]

0 commit comments

Comments
 (0)