Skip to content

Commit bebf5de

Browse files
committed
refactor pos arg errors to be more performant
1 parent 97bce10 commit bebf5de

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

mypy/checkexpr.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,8 +1792,8 @@ def check_callable_call(
17921792

17931793
arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
17941794

1795-
if not self._detect_missing_positional_arg(callee, arg_types, arg_kinds, args, context):
1796-
self.check_argument_count(
1795+
with self.msg.filter_errors(save_filtered_errors=True) as w:
1796+
ok = self.check_argument_count(
17971797
callee,
17981798
arg_types,
17991799
arg_kinds,
@@ -1804,6 +1804,16 @@ def check_callable_call(
18041804
callable_name,
18051805
)
18061806

1807+
if (
1808+
not ok
1809+
and not self.msg.prefer_simple_messages()
1810+
and self._detect_missing_positional_arg(
1811+
callee, arg_types, arg_kinds, args, context
1812+
)
1813+
):
1814+
pass
1815+
else:
1816+
self.msg.add_errors(w.filtered_errors())
18071817
self.check_argument_types(
18081818
arg_types,
18091819
arg_kinds,

0 commit comments

Comments
 (0)