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
Bug Report
Subclassing Any (as a result of untyped library imports) results in mypy being unable to find a common ancestor for two classes. Is this expected behavior?
To Reproduce
Run mypy on this file:
from typing import Any, Type
def test(arg: Type[A]) -> None:
return
def test2() -> None:
for obj in (B, C):
test(obj) # ERROR IS HERE
class A(Any):
pass
class B(A):
pass
class C(A):
pass
Expected Behavior
Because B and C are both subclasses of A, I expected this to typecheck without error, and When I change A to be a subclass of object instead, mypy passes.
Actual Behavior
test.py:9: error: Argument 1 to "test" has incompatible type "Type[object]"; expected "Type[A]"
(Write what happened.)
Your Environment
Mac OS Catalina 10.15.7
brew installed python 3.9
mypy==0.800
No command line flags or mypy.ini
The text was updated successfully, but these errors were encountered:
Bug Report
Subclassing
Any
(as a result of untyped library imports) results in mypy being unable to find a common ancestor for two classes. Is this expected behavior?To Reproduce
Run mypy on this file:
Expected Behavior
Because B and C are both subclasses of A, I expected this to typecheck without error, and When I change
A
to be a subclass ofobject
instead, mypy passes.Actual Behavior
(Write what happened.)
Your Environment
Mac OS Catalina 10.15.7
brew installed python 3.9
mypy==0.800
No command line flags or mypy.ini
The text was updated successfully, but these errors were encountered: