Open
Description
Bug Report
When type checking the following code the output changes depending on whether you use 1.6.0
or 1.7.1
.
To Reproduce
from dataclasses import dataclass
@dataclass(frozen=True)
class A:
attr_one: int
attr_two: int | None
@dataclass(frozen=True)
class B(A):
attr_two = None
instance = B(attr_one=1)
print(instance.attr_two)
Playground: https://mypy-play.net/?mypy=1.7.0&python=3.11&gist=f74740e7a7ef6bf0c9f88175a988aed5
The code is likely not doing what the author expects it to do, but the new message is wrong as attr_two
can be referenced and is certainly not an instance of B
.
Expected Behavior
main.py:15: error: Missing positional argument "attr_two" in call to "B" [call-arg]
Found 1 error in 1 file (checked 1 source file)
Actual Behavior
main.py:15: error: Missing positional argument "attr_two" in call to "B" [call-arg]
main.py:16: error: "B" not callable [operator]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
master
branch on Playground.