erroneous type mismatch with Union
and Literal
(false positive)
#17151
Labels
bug
mypy got something wrong
Union
and Literal
(false positive)
#17151
Bug Report
Mypy does not sufficiently simplify
Union
s andLiteral
s before some type checks (the reproduction case usesassert_type()
, but assignments and calls will also trigger the issue). The result is false positive errors.To Reproduce
[mypy-play.net]
Expected Behavior
The types are provably equivalent; no error should be raised.
Actual Behavior
Mypy does not sufficiently simplify the types, resulting in an erroneous "mismatch".
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: