-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Since #6370, we reject the following code:
from typing import Type
class Meta(type):
pass
class Thing(metaclass=Meta):
pass
def foo(x: Type[Thing]) -> Type[Thing]:
assert isinstance(x, Meta)
return x
with the error Incompatible return value type (got "Meta", expected "Type[Thing]").
Previously this worked because we thought that Meta and Type[Thing] had no overlap and so the rest of the function after the assert wasn't checked.
This caused one error in S.
The answer might be that we need to consider Type[Thing] to be a subtype of Meta?