assert_never not being properly handled when using TypeVars bound to Union Type #15467
Labels
bug
mypy got something wrong
topic-type-narrowing
Conditional type narrowing / binder
topic-type-variables
Bug Report
When using exhaustive checking either in if/elif/else or with match over TypeVars bound to Union Types
mypy
throws:Whereas this should have been the expected behavior and no errors should be raised.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=c90f6c776bc8d64645075dee9bf15032
Expected Behavior
The expected behavior should be identical as if operating over the Union Type, not throwing erros as the type has been exhausted,
Actual Behavior
An error is shown:
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: