File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1235,16 +1235,16 @@ def check_func_def(
1235
1235
new_frame .types [key ] = narrowed_type
1236
1236
self .binder .declarations [key ] = old_binder .declarations [key ]
1237
1237
with self .scope .push_function (defn ):
1238
- # We suppress reachability warnings when we use TypeVars with value
1238
+ # We suppress reachability warnings for empty generators (return; yield), since there's
1239
+ # no way to promote a function into a generator except by adding an "unreachable" yield.
1240
+ #
1241
+ # We also suppress reachability warnings when we use TypeVars with value
1239
1242
# restrictions: we only want to report a warning if a certain statement is
1240
1243
# marked as being suppressed in *all* of the expansions, but we currently
1241
1244
# have no good way of doing this.
1242
1245
#
1243
1246
# TODO: Find a way of working around this limitation
1244
- #
1245
- # We suppress reachability warnings for empty generators (return; yield), since there's
1246
- # no way to promote a function into a generator except by adding an "unreachable" yield.
1247
- if len (expanded ) >= 2 or _is_empty_generator (item ):
1247
+ if _is_empty_generator (item ) or len (expanded ) >= 2 :
1248
1248
self .binder .suppress_unreachable_warnings ()
1249
1249
self .accept (item .body )
1250
1250
unreachable = self .binder .is_unreachable ()
You can’t perform that action at this time.
0 commit comments