Skip to content

match on tuple subject not narrowed to Never for assert_never exhaustiveness #4066

Description

@asukaminato0721

Describe the Bug

from typing import assert_never
class RQ: pass
class QQ: pass
class RA: pass
class QA: pass
def f(q: RQ | QQ, a: RA | QA):
    match q, a:
        case RQ(), RA(): return 1
        case RQ(), _: return 2      # wildcard: covers the rest of the RQ row
        case QQ(), QA(): return 3
        case QQ(), _: return 4      # wildcard: covers the rest of the QQ row
        case unreachable:
            assert_never(unreachable)

ref zubanls/zuban#487

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions