Closed
Description
Steps to reproduce
mypy thinks the attribute defined on line 10 refers to the attribute defined on line 5:
import typing
class Base:
def __init__(self) -> None:
self.__private_attr: typing.Optional[int] = 69
class Derived(Base):
def __init__(self) -> None:
super().__init__()
self.__private_attr = ''
Current behavior
mypy reports the following error:
t1.py:10: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[int]")
Expected behavior
mypy shouldn't report anything.
mypy --version output
mypy 0.670
Metadata
Metadata
Assignees
Labels
No labels