-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / bindertopic-type-variables
Description
Bug Report
When using exhaustive checking either in if/elif/else or with match over TypeVars bound to Union Types mypy throws:
Argument 1 to "assert_never" has incompatible type "T"; expected "NoReturn" [arg-type]
expected "NoReturn" [arg-type]
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:
Argument 1 to "assert_never" has incompatible type "T"; expected "NoReturn" [arg-type]
expected "NoReturn" [arg-type]
Your Environment
- Mypy version used: 1.3.0
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): None - Python version used: 3.11
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / bindertopic-type-variables