Skip to content

Commit b608a66

Browse files
committed
Revert constraint deduplication
1 parent ff26ebf commit b608a66

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

mypy/constraints.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ def infer_constraints_for_callable(
251251
)
252252
c = infer_constraints(callee.arg_types[i], actual_type, SUPERTYPE_OF)
253253
constraints.extend(c)
254-
255254
if (
256255
param_spec
257256
and not any(c.type_var == param_spec.id for c in constraints)
@@ -271,8 +270,6 @@ def infer_constraints_for_callable(
271270
),
272271
)
273272
)
274-
275-
constraints = list(dict.fromkeys(constraints))
276273
if any(isinstance(v, ParamSpecType) for v in callee.variables):
277274
# As a perf optimization filter imprecise constraints only when we can have them.
278275
constraints = filter_imprecise_kinds(constraints)

test-data/unit/check-typeddict.test

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,21 +1164,22 @@ fc(b) # E: Argument 1 to "fc" has incompatible type "B"; expected "C"
11641164
from typing import TypedDict, TypeVar
11651165
A = TypedDict('A', {'x': int})
11661166
B = TypedDict('B', {'x': int}, total=False)
1167-
B2 = TypedDict('B2', {'x': int}, total=False)
11681167
C = TypedDict('C', {'x': int, 'y': str}, total=False)
1169-
C2 = TypedDict('C2', {'x': int, 'y': str}, total=False)
11701168
T = TypeVar('T')
11711169
def j(x: T, y: T) -> T: return x
11721170
a: A
11731171
b: B
1174-
b2: B2
11751172
c: C
1176-
c2: C2
1177-
reveal_type(j(a, b)) # N: Revealed type is "TypedDict({})"
1178-
reveal_type(j(b, b2)) # N: Revealed type is "TypedDict({'x'?: builtins.int})"
1179-
reveal_type(j(c, c2)) # N: Revealed type is "TypedDict({'x'?: builtins.int, 'y'?: builtins.str})"
1180-
reveal_type(j(b, c)) # N: Revealed type is "TypedDict({'x'?: builtins.int})"
1181-
reveal_type(j(c, b)) # N: Revealed type is "TypedDict({'x'?: builtins.int})"
1173+
reveal_type(j(a, b)) \
1174+
# N: Revealed type is "TypedDict({})"
1175+
reveal_type(j(b, b)) \
1176+
# N: Revealed type is "TypedDict({'x'?: builtins.int})"
1177+
reveal_type(j(c, c)) \
1178+
# N: Revealed type is "TypedDict({'x'?: builtins.int, 'y'?: builtins.str})"
1179+
reveal_type(j(b, c)) \
1180+
# N: Revealed type is "TypedDict({'x'?: builtins.int})"
1181+
reveal_type(j(c, b)) \
1182+
# N: Revealed type is "TypedDict({'x'?: builtins.int})"
11821183
[builtins fixtures/dict.pyi]
11831184
[typing fixtures/typing-typeddict.pyi]
11841185

0 commit comments

Comments
 (0)