Skip to content

Commit 2c57490

Browse files
committed
avoid generating duplicate notes
1 parent 7675c99 commit 2c57490

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

mypy/messages.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,15 +1182,6 @@ def no_variant_matches_arguments(
11821182
code=code,
11831183
)
11841184

1185-
if not all_kwargs_confident:
1186-
self.note(
1187-
f"Possible overload variant{plural_s(len(overload.items))}:",
1188-
context,
1189-
code=code,
1190-
)
1191-
for item in overload.items:
1192-
self.note(pretty_callable(item, self.options), context, offset=4, code=code)
1193-
11941185
if all_kwargs_confident and len(unexpected_kwargs) == len(arg_types):
11951186
return
11961187

test-data/unit/check-expressions.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,10 +2609,10 @@ def f(foobar: str) -> None: ...
26092609
def f(foobar: Union[int, str]) -> None: pass
26102610

26112611
f(random=[1,2,3]) # E: Unexpected keyword argument "random" for overloaded function "f" \
2612+
# E: No overload variant of "f" matches argument type "list[int]" \
26122613
# N: Possible overload variants: \
26132614
# N: def f(foobar: int) -> None \
2614-
# N: def f(foobar: str) -> None \
2615-
# E: No overload variant of "f" matches argument type "list[int]"
2615+
# N: def f(foobar: str) -> None
26162616
[builtins fixtures/list.pyi]
26172617

26182618
[case testOverloadMultipleUnexpectedKeywordArgs]
@@ -2661,10 +2661,10 @@ def f(foobar: Union[int, str]) -> None: pass
26612661

26622662
f(fobar=1, other=[1,2,3]) # E: Unexpected keyword argument "fobar" for overloaded function "f"; did you mean "foobar"? \
26632663
# E: Unexpected keyword argument "other" for overloaded function "f" \
2664+
# E: No overload variant of "f" matches argument types "int", "list[int]" \
26642665
# N: Possible overload variants: \
26652666
# N: def f(foobar: int) -> None \
2666-
# N: def f(foobar: str) -> None \
2667-
# E: No overload variant of "f" matches argument types "int", "list[int]"
2667+
# N: def f(foobar: str) -> None
26682668
[builtins fixtures/list.pyi]
26692669

26702670
[case testOverloadPositionalArgTypeMismatch]

0 commit comments

Comments
 (0)