Skip to content

Commit 656b09a

Browse files
authored
Use "parameter" instead of "argument" in overload error (#20994)
Fixes #20995
1 parent 38a116f commit 656b09a

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None:
10181018
if not is_callable_compatible(
10191019
impl, sig1, is_compat=is_subtype, is_proper_subtype=False, ignore_return=True
10201020
):
1021-
self.msg.overloaded_signatures_arg_specific(i + 1, defn.impl)
1021+
self.msg.overloaded_signatures_param_specific(i + 1, defn.impl)
10221022

10231023
# Is the overload alternative's return type a subtype of the implementation's?
10241024
if not (

mypy/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,10 +1659,10 @@ def overloaded_signatures_typevar_specific(self, index: int, context: Context) -
16591659
context,
16601660
)
16611661

1662-
def overloaded_signatures_arg_specific(self, index: int, context: Context) -> None:
1662+
def overloaded_signatures_param_specific(self, index: int, context: Context) -> None:
16631663
self.fail(
16641664
(
1665-
f"Overloaded function implementation does not accept all possible arguments "
1665+
f"Overloaded function implementation does not accept all possible parameters "
16661666
f"of signature {index}"
16671667
),
16681668
context,

test-data/unit/check-overloading.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def f(x: 'A') -> 'B': ...
226226
@overload
227227
def f(x: 'B') -> 'A': ...
228228

229-
def f(x: 'A') -> Any: # E: Overloaded function implementation does not accept all possible arguments of signature 2
229+
def f(x: 'A') -> Any: # E: Overloaded function implementation does not accept all possible parameters of signature 2
230230
pass
231231

232232
reveal_type(f(A())) # N: Revealed type is "__main__.B"
@@ -271,7 +271,7 @@ from typing import overload
271271
@overload # E: Single overload definition, multiple required
272272
def foo(x: int) -> None: ...
273273

274-
def foo(*args: int, **kw: str) -> None: # E: Overloaded function implementation does not accept all possible arguments of signature 1
274+
def foo(*args: int, **kw: str) -> None: # E: Overloaded function implementation does not accept all possible parameters of signature 1
275275
pass
276276
[builtins fixtures/tuple.pyi]
277277

@@ -4756,7 +4756,7 @@ def none_loose_impl(x: int) -> int: ...
47564756
def none_loose_impl(x: int) -> int:
47574757
return x
47584758
[out]
4759-
main:21: error: Overloaded function implementation does not accept all possible arguments of signature 1
4759+
main:21: error: Overloaded function implementation does not accept all possible parameters of signature 1
47604760
main:21: error: Overloaded function implementation cannot produce return type of signature 1
47614761

47624762
[case testTooManyUnionsException]
@@ -5426,7 +5426,7 @@ def dec_c(f: Callable[..., Any]) -> C:
54265426
def f_c(arg: int) -> None: ...
54275427
@overload
54285428
def f_c(arg: str) -> None: ...
5429-
@dec_c # E: Overloaded function implementation does not accept all possible arguments of signature 2
5429+
@dec_c # E: Overloaded function implementation does not accept all possible parameters of signature 2
54305430
def f_c(arg): ...
54315431
[builtins fixtures/dict.pyi]
54325432

test-data/unit/check-python38.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class Foo:
566566
@overload
567567
def f(self, *, b: bool = False) -> None: ...
568568

569-
def f(self, a: Optional[str] = None, /, *, b: bool = False) -> None: # E: Overloaded function implementation does not accept all possible arguments of signature 2
569+
def f(self, a: Optional[str] = None, /, *, b: bool = False) -> None: # E: Overloaded function implementation does not accept all possible parameters of signature 2
570570
...
571571

572572
class Bar:

test-data/unit/check-typeddict.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,7 @@ def f(self, **kwargs: Unpack[TD]) -> None:
38493849
def g(self, *, x: float) -> None: ...
38503850
@overload
38513851
def g(self, *, y: str) -> None: ...
3852-
def g(self, **kwargs: Unpack[TD]) -> None: # E: Overloaded function implementation does not accept all possible arguments of signature 1
3852+
def g(self, **kwargs: Unpack[TD]) -> None: # E: Overloaded function implementation does not accept all possible parameters of signature 1
38533853
z # E: Name "z" is not defined
38543854

38553855
class A:

test-data/unit/fine-grained.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7172,7 +7172,7 @@ class E:
71727172
pass
71737173
[out]
71747174
==
7175-
main:8: error: Overloaded function implementation does not accept all possible arguments of signature 2
7175+
main:8: error: Overloaded function implementation does not accept all possible parameters of signature 2
71767176
main:8: error: Overloaded function implementation cannot produce return type of signature 2
71777177

71787178
[case testOverloadsGenericTypevarUpdated]

0 commit comments

Comments
 (0)