Inherited, overridden attribute type reverted to the top parent class type #7394
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-inheritance
Inheritance and incompatible overrides
The issue type is probably quite bad, but example should quickly clear things up:
mypy test.py
outputs:where line 18 is the last line of above example
As to why I do
attr: str # type: ignore
- in a nutshell, in my caseA
class comes from external source and they botched type hints there so I try to fix them inB
. Not sure if it should have worked forC1
, but if it did I see it breaking inD
as a bug due mypy not being consistent, but then again maybe there is a good reason for it?.Tested with mypy 0.720
The text was updated successfully, but these errors were encountered: