From efec334232b3635be09e131b8750f0c51b139dc9 Mon Sep 17 00:00:00 2001 From: KevinRK29 Date: Fri, 13 Feb 2026 02:45:52 -0500 Subject: [PATCH] extracted to make a helper function and added more usages --- mypy/messages.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mypy/messages.py b/mypy/messages.py index c5756a463894e..8e6f885abd7d0 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -961,10 +961,12 @@ def too_few_arguments( else: msg = "Too few arguments" + for_function(callee) self.fail(msg, context, code=codes.CALL_ARG) + self.note_defined_here(callee, context) def missing_named_argument(self, callee: CallableType, context: Context, name: str) -> None: msg = f'Missing named argument "{name}"' + for_function(callee) self.fail(msg, context, code=codes.CALL_ARG) + self.note_defined_here(callee, context) def too_many_arguments(self, callee: CallableType, context: Context) -> None: if self.prefer_simple_messages(): @@ -972,6 +974,7 @@ def too_many_arguments(self, callee: CallableType, context: Context) -> None: else: msg = "Too many arguments" + for_function(callee) self.fail(msg, context, code=codes.CALL_ARG) + self.note_defined_here(callee, context) self.maybe_note_about_special_args(callee, context) def too_many_arguments_from_typed_dict( @@ -993,6 +996,7 @@ def too_many_positional_arguments(self, callee: CallableType, context: Context) else: msg = "Too many positional arguments" + for_function(callee) self.fail(msg, context) + self.note_defined_here(callee, context) self.maybe_note_about_special_args(callee, context) def maybe_note_about_special_args(self, callee: CallableType, context: Context) -> None: @@ -1035,6 +1039,10 @@ def unexpected_keyword_argument( self.unexpected_keyword_argument_for_function( for_function(callee), name, context, matches=matches ) + self.note_defined_here(callee, context) + + def note_defined_here(self, callee: CallableType, context: Context) -> None: + """Add a note pointing to the definition of the callee.""" module = find_defining_module(self.modules, callee) if module: assert callee.definition is not None