@@ -9287,14 +9287,38 @@ class B:
92879287
92889288class C(B):
92899289 prop = A.prop
9290- prop_t = AT.prop # E: Incompatible types in assignment (expression has type "C", base class "B" defined the type as "str")
9290+ prop_t = AT.prop
92919291
92929292reveal_type(C().prop) # N: Revealed type is "builtins.str"
92939293C().prop = "no" # E: Invalid self argument "C" to attribute function "prop" with type "Callable[[A, str], None]"
92949294reveal_type(C().prop_t) # N: Revealed type is "__main__.C"
92959295C().prop_t = 1 # E: Incompatible types in assignment (expression has type "int", variable has type "list[C]")
92969296[builtins fixtures/property.pyi]
92979297
9298+ [case testPropertyAliasClassAccess]
9299+ class A:
9300+ @property
9301+ def ro(self) -> int: ...
9302+
9303+ @property
9304+ def rw(self) -> int: ...
9305+ @rw.setter
9306+ def rw(self, val: int) -> None: ...
9307+
9308+ class B:
9309+ ro = A.ro
9310+ rw = A.rw
9311+
9312+ reveal_type(A.ro) # N: Revealed type is "builtins.property"
9313+ reveal_type(A.rw) # N: Revealed type is "builtins.property"
9314+ reveal_type(B.ro) # N: Revealed type is "builtins.property"
9315+ reveal_type(B.rw) # N: Revealed type is "builtins.property"
9316+ reveal_type(B().ro) # E: Invalid self argument "B" to attribute function "ro" with type "Callable[[A], int]" \
9317+ # N: Revealed type is "builtins.int"
9318+ reveal_type(B().rw) # E: Invalid self argument "B" to attribute function "rw" with type "Callable[[A], int]" \
9319+ # N: Revealed type is "builtins.int"
9320+ [builtins fixtures/property.pyi]
9321+
92989322[case testClassEqDecoratedAbstractNote]
92999323from abc import abstractmethod
93009324
0 commit comments