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:
1220
1220
case a:
1221
1221
reveal_type(a) # N: Revealed type is "builtins.int"
1222
1222
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
+
1223
1238
-- Guards --
1224
1239
1225
1240
[case testMatchSimplePatternGuard]
You can’t perform that action at this time.
0 commit comments