Skip to content

Commit 230a733

Browse files
always show overloaded function notes to remain consistent
1 parent 7f8ca0a commit 230a733

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

mypy/messages.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -872,11 +872,8 @@ def incompatible_argument_note(
872872
self.note_call(original_caller_type, call, context, code=code)
873873
if isinstance(callee_type, Instance) and callee_type.type.is_protocol:
874874
call = find_member("__call__", callee_type, callee_type, is_operator=True)
875-
if call is not None:
876-
item = get_proper_type(call)
877-
# should we print out all possible overloadings?
878-
if not (isinstance(item, Overloaded)):
879-
self.note_call(callee_type, call, context, code=code)
875+
if call:
876+
self.note_call(callee_type, call, context, code=code)
880877
self.maybe_note_concatenate_pos_args(original_caller_type, callee_type, context, code)
881878

882879
def maybe_note_concatenate_pos_args(

test-data/unit/check-protocols.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,8 @@ def func(caller: Caller) -> None:
25602560
pass
25612561

25622562
func(call)
2563-
func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[Union[int, str]], Union[int, str]]"; expected "Caller"
2563+
func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[Union[int, str]], Union[int, str]]"; expected "Caller" \
2564+
# N: "Caller.__call__" has type overloaded function
25642565
[out]
25652566

25662567
[case testCallableImplementsProtocolExtraNote]

0 commit comments

Comments
 (0)