-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statementtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)topic-reachabilityDetecting unreachable codeDetecting unreachable code
Description
def f(x: tuple[int, str, *tuple[range, ...]]) -> None:
match x:
case [1, *ts]:
reveal_type(ts)Produces no output, and with --warn-unreachable on says that line 4 is unreachable. But it's not unreachable; the case can match.
For comparison, pyright does not think the clause is unreachable but deduces an incorrect type (microsoft/pyright#7613).
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-match-statementPython 3.10's match statementPython 3.10's match statementtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)topic-reachabilityDetecting unreachable codeDetecting unreachable code