diff --git a/mypy/checkmember.py b/mypy/checkmember.py index b57cb57ba0167..5edd30f6732c5 100644 --- a/mypy/checkmember.py +++ b/mypy/checkmember.py @@ -323,7 +323,7 @@ def check_method_type(functype: FunctionLike, itype: Instance, is_classmethod: b # we passed to typ.fallback in analyze_member_access. See #1432. if isinstance(selfarg, TupleType): selfarg = selfarg.fallback - if not subtypes.is_equivalent(selfarg, itype): + if not subtypes.is_subtype(selfarg, itype): msg.invalid_method_type(item, context) else: # Check that cls argument has type 'Any' or valid class type. diff --git a/test-data/unit/check-selftype.test b/test-data/unit/check-selftype.test index f97eac4de41c3..52cf04e022137 100644 --- a/test-data/unit/check-selftype.test +++ b/test-data/unit/check-selftype.test @@ -333,3 +333,21 @@ class E: def __new__(cls) -> E: reveal_type(cls) # E: Revealed type is 'def () -> __main__.E' return cls() + +[case testSelfTypeProperty] +from typing import TypeVar + +T = TypeVar('T', bound='A') + +class A: + @property + def member(self: T) -> T: + pass + +class B(A): + pass + +reveal_type(A().member) # E: Revealed type is '__main__.A*' +reveal_type(B().member) # E: Revealed type is '__main__.B*' + +[builtins fixtures/property.pyi]