Summary
Consider the following snippet. ty, mypy, pyright and pyrefly all agree on the type of B1().x, but ty disagrees with the other three on the type of B2().x:
class A:
x: int
class B1(A):
x: bool
class B2(A):
def __init__(self) -> None:
self.x: bool = True
reveal_type(B1().x) # Ty, mypy, pyright, pyrefly: bool
reveal_type(B2().x) # Mypy, pyright, pyrefly: bool. Ty: int!
I think for compatibility, it would be better if we followed what the other type checkers do here.
I spotted this by looking at the ecosystem report in astral-sh/ruff#20723 (comment) (all 4 new unresolved-attribute errors on aiohttp in the ecosystem report are caused by this).
Version
No response