Closed
Description
Bug Report
When using Mypy 1.5.0, expressions like dict | Literal[""]
don't narrow correctly:
To Reproduce
from typing import Literal
x: Literal[""] | dict
y: Literal[""] | list
if x == "":
reveal_type(x)
if y == "":
reveal_type(y)
Expected Behavior
Both revealed types should be Literal[""]
. (As in Mypy 1.4.1.)
Actual Behavior
Mypy 1.5.0 does not narrow the revealed type for x
. y
gets narrowed correctly.
Your Environment
See Playground links.