Match involving unpacked tuple incorrectly marked unreachable · Issue #17095 · python/mypy (original) (raw)

def f(x: tuple[int, str, *tuple[range, ...]]) -> None: match x: case [1, *ts]: reveal_type(ts)

(Playground)

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).