Skip to content

Always try to report missing protocol members #19653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2137,10 +2137,6 @@ def report_protocol_problems(
}
if supertype.type.fullname in exclusions.get(type(subtype), []):
return
if any(isinstance(tp, UninhabitedType) for tp in get_proper_types(supertype.args)):
# We don't want to add notes for failed inference (e.g. Iterable[Never]).
# This will be only confusing a user even more.
return

class_obj = False
is_module = False
Expand Down Expand Up @@ -2197,6 +2193,11 @@ def report_protocol_problems(
# This is an obviously wrong type: too many missing members
return

if any(isinstance(tp, UninhabitedType) for tp in get_proper_types(supertype.args)):
# We don't want to add type conflict notes for failed inference (e.g. Iterable[Never]).
# This will be only confusing a user even more.
return

# Report member type conflicts
conflict_types = get_conflict_protocol_types(
subtype, supertype, class_obj=class_obj, options=self.options
Expand Down
Loading