Skip to content

Commit

Permalink
make the TODO-remove part second
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed Jul 20, 2023
1 parent ebc1cfa commit a64254c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,16 +1235,16 @@ 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 when we use TypeVars with value
# 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 also suppress reachability warnings when we use TypeVars with value
# restrictions: we only want to report a warning if a certain statement is
# marked as being suppressed in *all* of the expansions, but we currently
# have no good way of doing this.
#
# TODO: Find a way of working around this limitation
#
# 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.
if len(expanded) >= 2 or _is_empty_generator(item):
if _is_empty_generator(item) or len(expanded) >= 2:
self.binder.suppress_unreachable_warnings()
self.accept(item.body)
unreachable = self.binder.is_unreachable()
Expand Down

0 comments on commit a64254c

Please sign in to comment.