Skip to content

Commit 1d4395f

Browse files
authored
Use consistent capitalization of TypeVar (#13687)
Changed `Typevar` -> `TypeVar` in the error message from #13166. I was testing the mypy 0.980 pre-release builds and noticed that the error message was using inconsistent capitalization.
1 parent d619c78 commit 1d4395f

7 files changed

+12
-12
lines changed

mypy/message_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def with_additional_msg(self, info: str) -> ErrorMessage:
172172
TYPEVAR_UNEXPECTED_ARGUMENT: Final = 'Unexpected argument to "TypeVar()"'
173173
UNBOUND_TYPEVAR: Final = (
174174
"A function returning TypeVar should receive at least "
175-
"one argument containing the same Typevar"
175+
"one argument containing the same TypeVar"
176176
)
177177

178178
# Super

test-data/unit/check-classes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,7 @@ def error(u_c: Type[U]) -> P: # Error here, see below
32323232
return new_pro(u_c) # Error here, see below
32333233
[out]
32343234
main:11: note: Revealed type is "__main__.WizUser"
3235-
main:12: error: A function returning TypeVar should receive at least one argument containing the same Typevar
3235+
main:12: error: A function returning TypeVar should receive at least one argument containing the same TypeVar
32363236
main:13: error: Value of type variable "P" of "new_pro" cannot be "U"
32373237
main:13: error: Incompatible return value type (got "U", expected "P")
32383238

test-data/unit/check-errorcodes.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ z: y # E: Variable "__main__.y" is not valid as a type [valid-type] \
254254
from typing import TypeVar
255255

256256
T = TypeVar('T')
257-
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same Typevar [type-var]
257+
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
258258
x = f() # E: Need type annotation for "x" [var-annotated]
259259
y = [] # E: Need type annotation for "y" (hint: "y: List[<type>] = ...") [var-annotated]
260260
[builtins fixtures/list.pyi]

test-data/unit/check-generics.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,9 +1557,9 @@ A = TypeVar('A')
15571557
B = TypeVar('B')
15581558

15591559
def f1(x: A) -> A: ...
1560-
def f2(x: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1560+
def f2(x: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
15611561
def f3(x: B) -> B: ...
1562-
def f4(x: int) -> A: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1562+
def f4(x: int) -> A: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
15631563

15641564
y1 = f1
15651565
if int():
@@ -1608,8 +1608,8 @@ B = TypeVar('B')
16081608
T = TypeVar('T')
16091609
def outer(t: T) -> None:
16101610
def f1(x: A) -> A: ...
1611-
def f2(x: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1612-
def f3(x: T) -> A: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1611+
def f2(x: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
1612+
def f3(x: T) -> A: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
16131613
def f4(x: A) -> T: ...
16141614
def f5(x: T) -> T: ...
16151615

@@ -1778,7 +1778,7 @@ from typing import TypeVar
17781778
A = TypeVar('A')
17791779
B = TypeVar('B')
17801780
def f1(x: int, y: A) -> A: ...
1781-
def f2(x: int, y: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1781+
def f2(x: int, y: A) -> B: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
17821782
def f3(x: A, y: B) -> B: ...
17831783
g = f1
17841784
g = f2

test-data/unit/check-inference.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ g(None) # Ok
448448
f() # Ok because not used to infer local variable type
449449
g(a)
450450

451-
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same Typevar
451+
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
452452
def g(a: T) -> None: pass
453453
[out]
454454

@@ -2355,7 +2355,7 @@ def main() -> None:
23552355
[case testDontMarkUnreachableAfterInferenceUninhabited]
23562356
from typing import TypeVar
23572357
T = TypeVar('T')
2358-
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same Typevar
2358+
def f() -> T: pass # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
23592359

23602360
class C:
23612361
x = f() # E: Need type annotation for "x"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ def callback(func: Callable[[Any], Any]) -> None: ...
10661066
class Job(Generic[P]): ...
10671067

10681068
@callback
1069-
def run_job(job: Job[...]) -> T: ... # E: A function returning TypeVar should receive at least one argument containing the same Typevar
1069+
def run_job(job: Job[...]) -> T: ... # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
10701070
[builtins fixtures/tuple.pyi]
10711071

10721072
[case testTupleAndDictOperationsOnParamSpecArgsAndKwargs]

test-data/unit/check-typevar-unbound.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import TypeVar
44

55
T = TypeVar('T')
66

7-
def f() -> T: # E: A function returning TypeVar should receive at least one argument containing the same Typevar
7+
def f() -> T: # E: A function returning TypeVar should receive at least one argument containing the same TypeVar
88
...
99

1010
f()

0 commit comments

Comments
 (0)