@@ -2092,12 +2092,12 @@ class C:
20922092c = C(name='foo', b=Derived())
20932093c = attr.evolve(c)
20942094c = attr.evolve(c, name='foo')
2095- c = attr.evolve(c, 'foo') # E: Too many positional arguments for "evolve" of "C "
2095+ c = attr.evolve(c, 'foo') # E: Too many arguments for "evolve"
20962096c = attr.evolve(c, b=Derived())
20972097c = attr.evolve(c, b=Base())
2098- c = attr.evolve(c, b=Other()) # E: Argument "b" to "evolve" of "C" has incompatible type "Other"; expected "Base"
2099- c = attr.evolve(c, name=42) # E: Argument "name" to "evolve" of "C" has incompatible type "int"; expected "str"
2100- c = attr.evolve(c, foobar=42) # E: Unexpected keyword argument "foobar" for "evolve" of "C"
2098+ c = attr.evolve(c, b=Other())
2099+ c = attr.evolve(c, name=42)
2100+ c = attr.evolve(c, foobar=42)
21012101
21022102# test passing instance as 'inst' kw
21032103c = attr.evolve(inst=c, name='foo')
@@ -2141,7 +2141,7 @@ a = A(x=42)
21412141reveal_type(a) # N: Revealed type is "__main__.A[builtins.int]"
21422142a2 = attrs.evolve(a, x=42)
21432143reveal_type(a2) # N: Revealed type is "__main__.A[builtins.int]"
2144- a2 = attrs.evolve(a, x='42') # E: Argument "x" to "evolve" of "A[int]" has incompatible type "str"; expected "int"
2144+ a2 = attrs.evolve(a, x='42')
21452145reveal_type(a2) # N: Revealed type is "__main__.A[builtins.int]"
21462146
21472147[builtins fixtures/plugin_attrs.pyi]
@@ -2171,8 +2171,8 @@ class B:
21712171
21722172a_or_b: A[int] | B
21732173a2 = attrs.evolve(a_or_b, x=42, y=True)
2174- a2 = attrs.evolve(a_or_b, x=42, y=True, z='42') # E: Argument "z" to "evolve" of "Union[A[int], B]" has incompatible type "str"; expected "Never"
2175- a2 = attrs.evolve(a_or_b, x=42, y=True, w={}) # E: Argument "w" to "evolve" of "Union[A[int], B]" has incompatible type "Dict[Never, Never]"; expected "Never"
2174+ a2 = attrs.evolve(a_or_b, x=42, y=True, z='42')
2175+ a2 = attrs.evolve(a_or_b, x=42, y=True, w={})
21762176
21772177[builtins fixtures/plugin_attrs.pyi]
21782178
@@ -2219,7 +2219,7 @@ TA = TypeVar('TA', bound=A)
22192219def f(t: TA) -> TA:
22202220 t2 = attrs.evolve(t, x=42)
22212221 reveal_type(t2) # N: Revealed type is "TA`-1"
2222- t3 = attrs.evolve(t, x='42') # E: Argument "x" to "evolve" of "TA" has incompatible type "str"; expected "int"
2222+ t3 = attrs.evolve(t, x='42')
22232223 return t2
22242224
22252225f(A(x=42))
@@ -2266,9 +2266,10 @@ class B:
22662266T = TypeVar('T', A, B)
22672267
22682268def f(t: T) -> T:
2269- t2 = attrs.evolve(t, x=42) # E: Argument "x" to "evolve" of "B" has incompatible type "int"; expected "str"
2270- reveal_type(t2) # N: Revealed type is "__main__.A" # N: Revealed type is "__main__.B"
2271- t2 = attrs.evolve(t, x='42') # E: Argument "x" to "evolve" of "A" has incompatible type "str"; expected "int"
2269+ t2 = attrs.evolve(t, x=42)
2270+ reveal_type(t2) # N: Revealed type is "__main__.A" \
2271+ # N: Revealed type is "__main__.B"
2272+ t2 = attrs.evolve(t, x='42')
22722273 return t2
22732274
22742275f(A(x=42))
@@ -2289,13 +2290,13 @@ class C:
22892290c = C(name='foo')
22902291
22912292c = attr.assoc(c, name='test')
2292- c = attr.assoc(c, name=42) # E: Argument "name" to "assoc" of "C" has incompatible type "int"; expected "str"
2293+ c = attr.assoc(c, name=42)
22932294
22942295c = attrs.evolve(c, name='test')
2295- c = attrs.evolve(c, name=42) # E: Argument "name" to "evolve" of "C" has incompatible type "int"; expected "str"
2296+ c = attrs.evolve(c, name=42)
22962297
22972298c = attrs.assoc(c, name='test')
2298- c = attrs.assoc(c, name=42) # E: Argument "name" to "assoc" of "C" has incompatible type "int"; expected "str"
2299+ c = attrs.assoc(c, name=42)
22992300
23002301[builtins fixtures/plugin_attrs.pyi]
23012302[typing fixtures/typing-medium.pyi]
@@ -2518,6 +2519,7 @@ class C:
25182519
25192520
25202521obj = C(1)
2521- attrs.evolve(obj, x=2)
2522- attrs.evolve(obj, x="2")
2522+ attrs.evolve(obj, x=1, y=1)
2523+ attrs.evolve(obj, x=[])
2524+ attrs.evolve(obj, x="1")
25232525[builtins fixtures/plugin_attrs.pyi]
0 commit comments