File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff 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]
You can’t perform that action at this time.
0 commit comments