Example:
fromtypingimport*TypeT=TypeVar("TypeT", bound=type)
classBase:
field: str="Hey"classC1:
defmethod(self, other: type) ->str:
ifissubclass(other, Base):
# reveal_type(other) == Type[Base]returnother.fieldreturn"Hi"classC2(Generic[TypeT]):
defmethod(self, other: TypeT) ->str:
ifissubclass(other, Base):
# reveal_type(other) == TypeT`1returnother.field# mypy error: "TypeT" has no attribute "field"return"Hi"Actual behavior as of 0.740 included in the comments above. Expected behavior would be to not raise an error on the penultimate line.
Example:
Actual behavior as of 0.740 included in the comments above. Expected behavior would be to not raise an error on the penultimate line.