Closed
Description
Expected Behaviour
- Ability to type check abstract property
getters
andsetters
- The intention is to have an interface-like design using properties
Actual Behaviour & Repro Case
Python Code
from abc import abstractmethod
class A:
@property # error occurs here
@abstractmethod
def foo(self) -> int:
pass
@foo.setter # type: ignore
@abstractmethod
def foo(self, value: int) -> None:
pass
Mypy CLI
mypy --strict
Result
error: Overloaded method has both abstract and non-abstract variants
Notes
- The error message is defined here:
Lines 74 to 75 in a1ace48
- The error is thrown from here:
Lines 329 to 330 in 936ceac
- Removing
# type: ignore
from@foo.setter
causesmypy
to throwerror: Decorated property not supported
, just as in Decorated property not supported #1362
Related Issues
Current Solution
- Silence the error with
@property # type: ignore