Closed
Description
Covariant overriding of attributes is allowed though it's clearly unsafe. Example:
class A:
x: float
class B(A):
x: int # no error, though unsafe
def f(a: A) -> None:
a.x = 1.1
b = B()
f(b)
b.x # float at runtime, though declared as int
Mypy should reject x: int
in B
. If this is actually what the programmer intended, they can use # type: ignore
.