Skip to content

Exhaustiveness check in match statement #1286

@sander76

Description

@sander76

Describe the Bug

See sandbox

from typing import assert_never

class A:...

class B:...

def go(mdl:A|B):
    match mdl:
        case A():
            print('A')
        case B():
            print('B')
        case _:
            assert_never(mdl)

assert_never raises an issue which it shouldn't be raising?:

Argument A | Bis not assignable to parameterargwith typeNeverin functiontyping.assert_never`

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Sub-issues

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions