KEMBAR78
Match involving unpacked tuple incorrectly marked unreachable · Issue #17095 · python/mypy · GitHub
Skip to content

Match involving unpacked tuple incorrectly marked unreachable #17095

@JelleZijlstra

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions