Skip to content

Commit a374846

Browse files
committed
rephrase message
1 parent 5a57ac8 commit a374846

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

mypy/checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,10 @@ def is_implicit_any(t: Type) -> bool:
742742
for arg in item.arguments:
743743
init = arg.initialization_statement
744744
if init:
745-
fmt = 'Incompatible default argument for parameter "{}"'
745+
fmt = 'Incompatible default initializer for argument "{}"'
746746
self.check_simple_assignment(
747747
self.expr_checker.accept(init.lvalues[0]), init.rvalue, arg,
748-
fmt.format(arg.variable.name()), 'parameter', 'initializer')
748+
fmt.format(arg.variable.name()), 'argument', 'initializer')
749749

750750
# Type check body in a new scope.
751751
with self.binder.top_frame_context():

test-data/unit/check-functions.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class A: pass
388388

389389
[case testDefaultArgumentExpressions2]
390390
import typing
391-
def f(x: 'A' = B()) -> None: # E: Incompatible default argument for parameter "x" (initializer has type "B", parameter has type "A")
391+
def f(x: 'A' = B()) -> None: # E: Incompatible default initializer for argument "x" (initializer has type "B", argument has type "A")
392392
b = x # type: B # E: Incompatible types in assignment (expression has type "A", variable has type "B")
393393
a = x # type: A
394394

@@ -398,7 +398,7 @@ class A: pass
398398

399399
[case testDefaultArgumentsWithSubtypes]
400400
import typing
401-
def f(x: 'B' = A()) -> None: # E: Incompatible default argument for parameter "x" (initializer has type "A", parameter has type "B")
401+
def f(x: 'B' = A()) -> None: # E: Incompatible default initializer for argument "x" (initializer has type "A", argument has type "B")
402402
pass
403403
def g(x: 'A' = B()) -> None:
404404
pass
@@ -409,7 +409,7 @@ class B(A): pass
409409

410410
[case testMultipleDefaultArgumentExpressions]
411411
import typing
412-
def f(x: 'A' = B(), y: 'B' = B()) -> None: # E: Incompatible default argument for parameter "x" (initializer has type "B", parameter has type "A")
412+
def f(x: 'A' = B(), y: 'B' = B()) -> None: # E: Incompatible default initializer for argument "x" (initializer has type "B", argument has type "A")
413413
pass
414414
def h(x: 'A' = A(), y: 'B' = B()) -> None:
415415
pass
@@ -420,7 +420,7 @@ class B: pass
420420

421421
[case testMultipleDefaultArgumentExpressions2]
422422
import typing
423-
def g(x: 'A' = A(), y: 'B' = A()) -> None: # E: Incompatible default argument for parameter "y" (initializer has type "A", parameter has type "B")
423+
def g(x: 'A' = A(), y: 'B' = A()) -> None: # E: Incompatible default initializer for argument "y" (initializer has type "A", argument has type "B")
424424
pass
425425

426426
class A: pass

test-data/unit/check-inference.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ from typing import Callable
11191119
def f(a: Callable[..., None] = lambda *a, **k: None):
11201120
pass
11211121

1122-
def g(a: Callable[..., None] = lambda *a, **k: 1): # E: Incompatible default argument for parameter "a" (initializer has type Callable[[VarArg(Any), KwArg(Any)], int], parameter has type Callable[..., None])
1122+
def g(a: Callable[..., None] = lambda *a, **k: 1): # E: Incompatible default initializer for argument "a" (initializer has type Callable[[VarArg(Any), KwArg(Any)], int], argument has type Callable[..., None])
11231123
pass
11241124
[builtins fixtures/dict.pyi]
11251125

test-data/unit/check-modules.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ def f(x: int = ...) -> None: pass
475475
[file m.pyi]
476476
def g(x: int = '') -> None: pass
477477
[out]
478-
tmp/m.pyi:1: error: Incompatible default argument for parameter "x" (initializer has type "str", parameter has type "int")
479-
main:2: error: Incompatible default argument for parameter "x" (initializer has type "ellipsis", parameter has type "int")
478+
tmp/m.pyi:1: error: Incompatible default initializer for argument "x" (initializer has type "str", argument has type "int")
479+
main:2: error: Incompatible default initializer for argument "x" (initializer has type "ellipsis", argument has type "int")
480480

481481
[case testEllipsisDefaultArgValueInNonStub]
482-
def f(x: int = ...) -> None: pass # E: Incompatible default argument for parameter "x" (initializer has type "ellipsis", parameter has type "int")
482+
def f(x: int = ...) -> None: pass # E: Incompatible default initializer for argument "x" (initializer has type "ellipsis", argument has type "int")
483483
[out]
484484

485485
[case testStarImportOverlapping]

test-data/unit/check-optional.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ f(None)
127127

128128
[case testNoInferOptionalFromDefaultNone]
129129
# flags: --no-implicit-optional
130-
def f(x: int = None) -> None: # E: Incompatible default argument for parameter "x" (initializer has type None, parameter has type "int")
130+
def f(x: int = None) -> None: # E: Incompatible default initializer for argument "x" (initializer has type None, argument has type "int")
131131
pass
132132
[out]
133133

@@ -140,7 +140,7 @@ f(None)
140140

141141
[case testNoInferOptionalFromDefaultNoneComment]
142142
# flags: --no-implicit-optional
143-
def f(x=None): # E: Incompatible default argument for parameter "x" (initializer has type None, parameter has type "int")
143+
def f(x=None): # E: Incompatible default initializer for argument "x" (initializer has type None, argument has type "int")
144144
# type: (int) -> None
145145
pass
146146
[out]

0 commit comments

Comments
 (0)