You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would say that this is indeed a bug. It won't be a bug in the positive case (as a class that redefines __eq__ MAY be equal to a string), but it should definitely narrow in the negative case. Here you can see that the problem manifest itself depending on if you redefined __eq__ or not:
Bug Report
Strangely, type-narrowing for unions including a Literal works for
int
but notdatetime
To Reproduce
Mypy Playground. Copied here for convenience:
Expected Behavior
No errors.
Actual Behavior
Has errors:
Your Environment
mypy.ini
(and other config files): <none>The text was updated successfully, but these errors were encountered: