Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.
Describe the bug
Hi, I'm using dataclasses with frozen=True as immutable values.
However the very useful 'replace' function from the same module doesn't type correctly (see docs ).
This allows to create a new value by changing fields specified via keyword args.
To Reproduce
Create a dataclass, use the replace function with incorrect arguments.
Expected behavior
Typecheck fail.
Screenshots or Code
from dataclasses import dataclass,replace
@dataclass
class A:
x : int
y : int
a = A(0,1)
b = replace(a,x=1) #types correctly
c = replace(a,not_a_field=1) #should not typecheck
VS Code extension or command-line
VS Code extension.
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.
Describe the bug
Hi, I'm using dataclasses with frozen=True as immutable values.
However the very useful 'replace' function from the same module doesn't type correctly (see docs ).
This allows to create a new value by changing fields specified via keyword args.
To Reproduce
Create a dataclass, use the replace function with incorrect arguments.
Expected behavior
Typecheck fail.
Screenshots or Code
VS Code extension or command-line
VS Code extension.