diff --git a/mypy/messages.py b/mypy/messages.py index 571cebb1b174..79c040a4239b 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -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 @@ -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