False positive with inherited writable property that reads subtype in subclass #14301
Labels
bug
mypy got something wrong
topic-descriptors
Properties, class vs. instance attributes
topic-inheritance
Inheritance and incompatible overrides
If I run mypy on the following code:
It reports:
I'd expect mypy to not report any error, as
bool
is a subtype ofint
and therefore the property type returned by the subclass always conforms to the property type defined in the superclass.This problem only occurs for writable properties: if I remove the setter definitions from both the superclass and the subclass, no false positive is reported.
I can produce this problem using mypy 0.991 on Python 3.10.8. When using mypy 0.981 instead, no false positive is reported.
The text was updated successfully, but these errors were encountered: