False negative: typing.Literal[<Union expression>]
#17260
Labels
bug
mypy got something wrong
semantic-analyzer
Problems that happen during semantic analysis
topic-literal-types
topic-runtime-semantics
mypy doesn't model runtime semantics correctly
Bug Report, To Reproduce, & Actual Behaviour
See mypy playground
For the runtime counterpart, this will result in a
TypeError: unsupported operand type(s) for |: 'int' and 'NoneType'
if the module doesn't havefrom __future__ import annotations
or invalid results for runtime annotation inspectors (e.g. in the case oftyping.Literal[1 | 2]
).Expected Behavior
Maybe:
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: