Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,17 @@ def incompatible_argument_note(
self.report_protocol_problems(
original_caller_type, callee_type, context, parent_error=parent_error
)
if (
isinstance(callee_type, TypeType)
and isinstance(callee_type.item, Instance)
and isinstance(original_caller_type, CallableType)
and callee_type.item.type.is_protocol
):
proper_ret_type = get_proper_type(original_caller_type.ret_type)
if isinstance(proper_ret_type, Instance):
self.report_protocol_problems(
proper_ret_type, callee_type.item, context, code=code
)
if isinstance(callee_type, UnionType):
for item in callee_type.items:
item = get_proper_type(item)
Expand Down
Loading