You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe mypy should reject non-existent fields when dataclasses.replace is used.
To Reproduce
fromdataclassesimportdataclass, replace@dataclass(frozen=True)classA:
x : inty : inta=A(0, 1)
b=replace(a, x=1) # okc=replace(a, not_a_field=1) # should be: error: "A" has no attribute "not_a_field" [attr-defined]
This issue was originally reported by @LunarLanding here:
microsoft/pyright#1047
I believe mypy should reject non-existent fields when dataclasses.replace is used.
To Reproduce
Mypy Playground
Expected Behavior
Error: "A" has no attribute "not_a_field" [attr-defined]
Actual Behavior
No error
Related Issue
#14525
The text was updated successfully, but these errors were encountered: