Closed
Description
Defining a property in a superclass and then using a @property
decorator in a subclass does not detect that the signatures match.
I think this is a bug, but I'm not sure if there are some edge cases I haven't thought through that make this error valid.
Here's code:
class Superclass:
prop: int
class Subclass(Superclass):
@property
def prop(self) -> int: ...
The mypy error:
test.py:10: error: Signature of "prop" incompatible with supertype "Superclass"
Mypy --version
is mypy 0.770
.
I tried to look through the list of issues with @property
but couldn't determine if this is a duplicate; the others (that seem largely resolved) have to do with @property
whereas this has to do with @property
when in a subclass with a superclass that has a type annotation.
This might be a duplicate of #5936; if so, please close this. I wasn't sure because that seems to have to do with setters, which this does not.
Metadata
Metadata
Assignees
Labels
No labels