Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test-data/unit/check-python310.test
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,21 @@ def main() -> None:
case a:
reveal_type(a) # N: Revealed type is "builtins.int"

[case testMatchCapturePatternFromAsyncFunctionReturningUnion-xfail]
async def func1(arg: bool) -> str | int: ...
async def func2(arg: bool) -> bytes | int: ...

async def main() -> None:
match await func1(True):
case str(a):
match await func2(True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this nesting add anything to the test? Better to keep tests simple unless the additional complexity tests something interesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the lead of the preceding test case. See above ^

case c:
reveal_type(a) # N: Revealed type is "builtins.str"
reveal_type(c) # N: Revealed type is "Union[builtins.bytes, builtins.int]"
reveal_type(a) # N: Revealed type is "builtins.str"
case a:
reveal_type(a) # N: Revealed type is "builtins.int"

-- Guards --

[case testMatchSimplePatternGuard]
Expand Down