diff --git a/mypy/checker.py b/mypy/checker.py index c266b3f0c009..9656fd23b645 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -1235,8 +1235,9 @@ def check_func_def( new_frame.types[key] = narrowed_type self.binder.declarations[key] = old_binder.declarations[key] with self.scope.push_function(defn): - # We suppress reachability warnings for empty generators (return; yield), since there's - # no way to promote a function into a generator except by adding an "unreachable" yield. + # We suppress reachability warnings for empty generator functions + # (return; yield), since the most idiomatic way to promote a function into a + # generator function is often to add an "unreachable" yield. # # We also suppress reachability warnings when we use TypeVars with value # restrictions: we only want to report a warning if a certain statement is