Skip to content

Commit 85996a7

Browse files
committed
extracted to make a helper function and added more usages
1 parent 688121a commit 85996a7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mypy/messages.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,17 +937,20 @@ def too_few_arguments(
937937
else:
938938
msg = "Too few arguments" + for_function(callee)
939939
self.fail(msg, context, code=codes.CALL_ARG)
940+
self.note_defined_here(callee, context)
940941

941942
def missing_named_argument(self, callee: CallableType, context: Context, name: str) -> None:
942943
msg = f'Missing named argument "{name}"' + for_function(callee)
943944
self.fail(msg, context, code=codes.CALL_ARG)
945+
self.note_defined_here(callee, context)
944946

945947
def too_many_arguments(self, callee: CallableType, context: Context) -> None:
946948
if self.prefer_simple_messages():
947949
msg = "Too many arguments"
948950
else:
949951
msg = "Too many arguments" + for_function(callee)
950952
self.fail(msg, context, code=codes.CALL_ARG)
953+
self.note_defined_here(callee, context)
951954
self.maybe_note_about_special_args(callee, context)
952955

953956
def too_many_arguments_from_typed_dict(
@@ -969,6 +972,7 @@ def too_many_positional_arguments(self, callee: CallableType, context: Context)
969972
else:
970973
msg = "Too many positional arguments" + for_function(callee)
971974
self.fail(msg, context)
975+
self.note_defined_here(callee, context)
972976
self.maybe_note_about_special_args(callee, context)
973977

974978
def maybe_note_about_special_args(self, callee: CallableType, context: Context) -> None:
@@ -1011,6 +1015,10 @@ def unexpected_keyword_argument(
10111015
self.unexpected_keyword_argument_for_function(
10121016
for_function(callee), name, context, matches=matches
10131017
)
1018+
self.note_defined_here(callee, context)
1019+
1020+
def note_defined_here(self, callee: CallableType, context: Context) -> None:
1021+
"""Add a note pointing to the definition of the callee."""
10141022
module = find_defining_module(self.modules, callee)
10151023
if (
10161024
module

0 commit comments

Comments
 (0)