@@ -735,7 +735,44 @@ class A(metaclass=ABCMeta):
735735 def x(self) -> int: pass
736736 @x.setter
737737 def x(self, x: int) -> None: pass
738- [out]
738+
739+ [case testReadWriteDeleteAbstractProperty]
740+ from abc import ABC, abstractmethod
741+ class Abstract(ABC):
742+ @property
743+ @abstractmethod
744+ def prop(self) -> str: ...
745+
746+ @prop.setter
747+ @abstractmethod
748+ def prop(self, code: str) -> None: ...
749+
750+ @prop.deleter
751+ @abstractmethod
752+ def prop(self) -> None: ...
753+
754+ class Good(Abstract):
755+ @property
756+ def prop(self) -> str: ...
757+ @prop.setter
758+ def prop(self, code: str) -> None: ...
759+ @prop.deleter
760+ def prop(self) -> None: ...
761+
762+ class Bad1(Abstract):
763+ @property # E: Read-only property cannot override read-write property
764+ def prop(self) -> str: ...
765+
766+ class ThisShouldProbablyError(Abstract):
767+ @property
768+ def prop(self) -> str: ...
769+ @prop.setter
770+ def prop(self, code: str) -> None: ...
771+
772+ a = Good()
773+ reveal_type(a.prop) # N: Revealed type is "builtins.str"
774+ a.prop = 123 # E: Incompatible types in assignment (expression has type "int", variable has type "str")
775+ [builtins fixtures/property.pyi]
739776
740777[case testInstantiateClassWithReadOnlyAbstractProperty]
741778from abc import abstractproperty, ABCMeta
@@ -767,7 +804,7 @@ b = B()
767804b.x() # E: "int" not callable
768805[builtins fixtures/property.pyi]
769806
770- [case testImplementReradWriteAbstractPropertyViaProperty ]
807+ [case testImplementReadWriteAbstractPropertyViaProperty ]
771808from abc import abstractproperty, ABCMeta
772809class A(metaclass=ABCMeta):
773810 @abstractproperty
0 commit comments