Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict equality false positive with Type[Any] #7823

Closed
JukkaL opened this issue Oct 30, 2019 · 0 comments · Fixed by #7824
Closed

Strict equality false positive with Type[Any] #7823

JukkaL opened this issue Oct 30, 2019 · 0 comments · Fixed by #7824
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-1-normal

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 30, 2019

When using --strict-equality, the following program produces a false positive error, since Type[Any] should overlap with all type objects:

from typing import Any
data: Any = []

# Non-overlapping container check (element type: "Type[Any]", container item type: "ABCMeta")
print(type(data) in [dict, list])  # True

cc @ilevkivskyi

@JukkaL JukkaL added bug mypy got something wrong priority-1-normal false-positive mypy gave an error on correct code labels Oct 30, 2019
ilevkivskyi added a commit that referenced this issue Oct 30, 2019
Fixes #7823

This makes `Type[object]`, `Type[Any]`, and `type` behave the same way w.r.t. type overlaps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-1-normal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant