-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrong
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong