Skip to content

Commit 7215551

Browse files
committed
Tweak wording
1 parent ac46c84 commit 7215551

12 files changed

+27
-27
lines changed

mypy/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ def could_not_infer_type_arguments(
13751375
callee_name = callable_name(callee_type)
13761376
if callee_name is not None:
13771377
self.fail(
1378-
f"Cannot infer type argument to type parameter {format_type(tv, self.options)} of {callee_name}",
1378+
f"Cannot infer value of type parameter {format_type(tv, self.options)} of {callee_name}",
13791379
context,
13801380
)
13811381
if callee_name == "<dict>":

test-data/unit/check-dataclasses.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ class A(Generic[T]):
705705
return self.z # E: Incompatible return value type (got "list[T]", expected "T")
706706

707707
reveal_type(A) # N: Revealed type is "def [T] (x: T`1, y: T`1, z: builtins.list[T`1]) -> __main__.A[T`1]"
708-
A(1, 2, ["a", "b"]) # E: Cannot infer type argument to type parameter "T" of "A"
708+
A(1, 2, ["a", "b"]) # E: Cannot infer value of type parameter "T" of "A"
709709
a = A(1, 2, [1, 2])
710710
reveal_type(a) # N: Revealed type is "__main__.A[builtins.int]"
711711
reveal_type(a.x) # N: Revealed type is "builtins.int"

test-data/unit/check-expressions.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,7 @@ a = {'a': 1}
18781878
b = {'z': 26, **a}
18791879
c = {**b}
18801880
d = {**a, **b, 'c': 3}
1881-
e = {1: 'a', **a} # E: Cannot infer type argument to type parameter "KT" of <dict> \
1881+
e = {1: 'a', **a} # E: Cannot infer value of type parameter "KT" of <dict> \
18821882
# N: Try assigning the literal to a variable annotated as dict[<key>, <val>]
18831883
f = {**b} # type: Dict[int, int] # E: Unpacked dict entry 0 has incompatible type "dict[str, int]"; expected "SupportsKeysAndGetItem[int, int]"
18841884
g = {**Thing()}
@@ -1893,7 +1893,7 @@ i = {**Thing()} # type: Dict[int, int] # E: Unpacked dict entry 0 has incompat
18931893
# N: def keys(self) -> Iterable[int] \
18941894
# N: Got: \
18951895
# N: def keys(self) -> Iterable[str]
1896-
j = {1: 'a', **Thing()} # E: Cannot infer type argument to type parameter "KT" of <dict> \
1896+
j = {1: 'a', **Thing()} # E: Cannot infer value of type parameter "KT" of <dict> \
18971897
# N: Try assigning the literal to a variable annotated as dict[<key>, <val>]
18981898
[builtins fixtures/dict.pyi]
18991899
[typing fixtures/typing-medium.pyi]

test-data/unit/check-generics.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def func2(x: SameNode[T]) -> SameNode[T]:
584584
return x
585585
reveal_type(func2) # N: Revealed type is "def [T] (x: __main__.Node[T`-1, T`-1]) -> __main__.Node[T`-1, T`-1]"
586586

587-
func2(Node(1, 'x')) # E: Cannot infer type argument to type parameter "T" of "func2"
587+
func2(Node(1, 'x')) # E: Cannot infer value of type parameter "T" of "func2"
588588
y = func2(Node('x', 'x'))
589589
reveal_type(y) # N: Revealed type is "__main__.Node[builtins.str, builtins.str]"
590590

@@ -888,7 +888,7 @@ def fun2(v: Vec[T], scale: T) -> Vec[T]:
888888

889889
reveal_type(fun1([(1, 1)])) # N: Revealed type is "builtins.int"
890890
fun1(1) # E: Argument 1 to "fun1" has incompatible type "int"; expected "list[tuple[bool, bool]]"
891-
fun1([(1, 'x')]) # E: Cannot infer type argument to type parameter "T" of "fun1"
891+
fun1([(1, 'x')]) # E: Cannot infer value of type parameter "T" of "fun1"
892892

893893
reveal_type(fun2([(1, 1)], 1)) # N: Revealed type is "builtins.list[tuple[builtins.int, builtins.int]]"
894894
fun2([('x', 'x')], 'x') # E: Value of type variable "T" of "fun2" cannot be "str"
@@ -909,7 +909,7 @@ def f(x: Node[T, T]) -> TupledNode[T]:
909909
return Node(x.x, (x.x, x.x))
910910

911911
f(1) # E: Argument 1 to "f" has incompatible type "int"; expected "Node[Never, Never]"
912-
f(Node(1, 'x')) # E: Cannot infer type argument to type parameter "T" of "f"
912+
f(Node(1, 'x')) # E: Cannot infer value of type parameter "T" of "f"
913913
reveal_type(Node('x', 'x')) # N: Revealed type is "a.Node[builtins.str, builtins.str]"
914914

915915
[file a.py]

test-data/unit/check-inference-context.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ class D(C): ...
10091009

10101010
def f(x: List[T], y: List[T]) -> List[T]: ...
10111011

1012-
f([C()], [D()]) # E: Cannot infer type argument to type parameter "T" of "f"
1012+
f([C()], [D()]) # E: Cannot infer value of type parameter "T" of "f"
10131013
[builtins fixtures/list.pyi]
10141014

10151015
[case testInferTypeVariableFromTwoGenericTypes3]

test-data/unit/check-inference.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,8 @@ class A(Generic[T]): pass
693693
class B: pass
694694

695695

696-
f(ao, ab) # E: Cannot infer type argument to type parameter "T" of "f"
697-
f(ab, ao) # E: Cannot infer type argument to type parameter "T" of "f"
696+
f(ao, ab) # E: Cannot infer value of type parameter "T" of "f"
697+
f(ab, ao) # E: Cannot infer value of type parameter "T" of "f"
698698
f(ao, ao)
699699
f(ab, ab)
700700

@@ -3774,8 +3774,8 @@ reveal_type(f(x, [])) # N: Revealed type is "builtins.str"
37743774
reveal_type(f(["yes"], [])) # N: Revealed type is "builtins.str"
37753775

37763776
empty: List[NoReturn]
3777-
f(x, empty) # E: Cannot infer type argument to type parameter "T" of "f"
3778-
f(["no"], empty) # E: Cannot infer type argument to type parameter "T" of "f"
3777+
f(x, empty) # E: Cannot infer value of type parameter "T" of "f"
3778+
f(["no"], empty) # E: Cannot infer value of type parameter "T" of "f"
37793779
[builtins fixtures/list.pyi]
37803780

37813781
[case testInferenceWorksWithEmptyCollectionsUnion]
@@ -4163,5 +4163,5 @@ def foo(
41634163

41644164
def bar(y: float) -> float: ...
41654165

4166-
foo(1, None, bar) # E: Cannot infer type argument to type parameter "T2" of "foo"
4166+
foo(1, None, bar) # E: Cannot infer value of type parameter "T2" of "foo"
41674167
[builtins fixtures/tuple.pyi]

test-data/unit/check-literal.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,9 +2989,9 @@ def g(a: T, t: A[T]) -> T: ...
29892989

29902990
def check(obj: A[Literal[1]]) -> None:
29912991
reveal_type(f(obj, 1)) # N: Revealed type is "Literal[1]"
2992-
reveal_type(f(obj, '')) # E: Cannot infer type argument to type parameter "T" of "f" \
2992+
reveal_type(f(obj, '')) # E: Cannot infer value of type parameter "T" of "f" \
29932993
# N: Revealed type is "Any"
29942994
reveal_type(g(1, obj)) # N: Revealed type is "Literal[1]"
2995-
reveal_type(g('', obj)) # E: Cannot infer type argument to type parameter "T" of "g" \
2995+
reveal_type(g('', obj)) # E: Cannot infer value of type parameter "T" of "g" \
29962996
# N: Revealed type is "Any"
29972997
[builtins fixtures/tuple.pyi]

test-data/unit/check-overloading.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,10 +3370,10 @@ def wrapper() -> None:
33703370
obj2: Union[W1[A], W2[B]]
33713371

33723372
reveal_type(foo(obj2)) # N: Revealed type is "Union[__main__.A, __main__.B]"
3373-
bar(obj2) # E: Cannot infer type argument to type parameter "T" of "bar"
3373+
bar(obj2) # E: Cannot infer value of type parameter "T" of "bar"
33743374

33753375
b1_overload: A = foo(obj2) # E: Incompatible types in assignment (expression has type "Union[A, B]", variable has type "A")
3376-
b1_union: A = bar(obj2) # E: Cannot infer type argument to type parameter "T" of "bar"
3376+
b1_union: A = bar(obj2) # E: Cannot infer value of type parameter "T" of "bar"
33773377

33783378
[case testOverloadingInferUnionReturnWithObjectTypevarReturn]
33793379
from typing import overload, Union, TypeVar, Generic
@@ -3496,7 +3496,7 @@ def t_is_same_bound(arg1: T1, arg2: S) -> Tuple[T1, S]:
34963496
# The arguments in the tuple are swapped
34973497
x3: Union[List[S], List[Tuple[S, T1]]]
34983498
y3: S
3499-
Dummy[T1]().foo(x3, y3) # E: Cannot infer type argument to type parameter "S" of "foo" of "Dummy" \
3499+
Dummy[T1]().foo(x3, y3) # E: Cannot infer value of type parameter "S" of "foo" of "Dummy" \
35003500
# E: Argument 1 to "foo" of "Dummy" has incompatible type "Union[list[S], list[tuple[S, T1]]]"; expected "list[tuple[T1, Any]]"
35013501

35023502
x4: Union[List[int], List[Tuple[C, int]]]

test-data/unit/check-parameter-specification.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ def d(f: Callable[P, None], fn: Callable[Concatenate[Callable[P, None], P], None
21352135

21362136
reveal_type(d(a, f1)) # N: Revealed type is "def (i: builtins.int)"
21372137
reveal_type(d(a, f2)) # N: Revealed type is "def (i: builtins.int)"
2138-
reveal_type(d(b, f1)) # E: Cannot infer type argument to type parameter "P" of "d" \
2138+
reveal_type(d(b, f1)) # E: Cannot infer value of type parameter "P" of "d" \
21392139
# N: Revealed type is "def (*Any, **Any)"
21402140
reveal_type(d(b, f2)) # N: Revealed type is "def (builtins.int)"
21412141
[builtins fixtures/paramspec.pyi]

test-data/unit/check-plugin-attrs.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ reveal_type(a) # N: Revealed type is "__main__.A[builtins.int]"
470470
reveal_type(a.x) # N: Revealed type is "builtins.list[builtins.int]"
471471
reveal_type(a.y) # N: Revealed type is "builtins.int"
472472

473-
A(['str'], 7) # E: Cannot infer type argument to type parameter "T" of "A"
474-
A([1], '2') # E: Cannot infer type argument to type parameter "T" of "A"
473+
A(['str'], 7) # E: Cannot infer value of type parameter "T" of "A"
474+
A([1], '2') # E: Cannot infer value of type parameter "T" of "A"
475475

476476
[builtins fixtures/list.pyi]
477477

0 commit comments

Comments
 (0)