-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statementtopic-reachabilityDetecting unreachable codeDetecting unreachable code
Description
Bug Report
input: tuple[list, list]
match input:
case _, []:
print(1)
case [], _:
print(2)
case _:
print(3)
This is perfectly valid at runtime, but mypy warns about unreachable
at print(2)
. reveal_type
shows tuple[Never, list]
.
To Reproduce
Expected Behavior
Should not error
Actual Behavior
main.py:6: error: Statement is unreachable [unreachable]
main.py:8: note: Revealed type is "tuple[Never, builtins.list[builtins.int]]"
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used:
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used:
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statementtopic-reachabilityDetecting unreachable codeDetecting unreachable code