@@ -1651,11 +1651,11 @@ def visit_for_stmt(self, s: ForStmt) -> None:
1651
1651
1652
1652
def visit_break_stmt (self , s : BreakStmt ) -> None :
1653
1653
if self .loop_depth == 0 :
1654
- self .fail ("'break' outside loop" , s , True )
1654
+ self .fail ("'break' outside loop" , s , True , blocker = True )
1655
1655
1656
1656
def visit_continue_stmt (self , s : ContinueStmt ) -> None :
1657
1657
if self .loop_depth == 0 :
1658
- self .fail ("'continue' outside loop" , s , True )
1658
+ self .fail ("'continue' outside loop" , s , True , blocker = True )
1659
1659
1660
1660
def visit_if_stmt (self , s : IfStmt ) -> None :
1661
1661
infer_reachability_of_if_statement (s , pyversion = self .pyversion )
@@ -1783,7 +1783,7 @@ def visit_star_expr(self, expr: StarExpr) -> None:
1783
1783
1784
1784
def visit_yield_from_expr (self , e : YieldFromExpr ) -> None :
1785
1785
if not self .is_func_scope (): # not sure
1786
- self .fail ("'yield from' outside function" , e )
1786
+ self .fail ("'yield from' outside function" , e , True , blocker = True )
1787
1787
else :
1788
1788
self .function_stack [- 1 ].is_generator = True
1789
1789
if e .expr :
@@ -2036,7 +2036,7 @@ def visit__promote_expr(self, expr: PromoteExpr) -> None:
2036
2036
2037
2037
def visit_yield_expr (self , expr : YieldExpr ) -> None :
2038
2038
if not self .is_func_scope ():
2039
- self .fail ("'yield' outside function" , expr )
2039
+ self .fail ("'yield' outside function" , expr , True , blocker = True )
2040
2040
else :
2041
2041
self .function_stack [- 1 ].is_generator = True
2042
2042
if expr .expr :
@@ -2250,13 +2250,14 @@ def name_not_defined(self, name: str, ctx: Context) -> None:
2250
2250
def name_already_defined (self , name : str , ctx : Context ) -> None :
2251
2251
self .fail ("Name '{}' already defined" .format (name ), ctx )
2252
2252
2253
- def fail (self , msg : str , ctx : Context , serious : bool = False ) -> None :
2253
+ def fail (self , msg : str , ctx : Context , serious : bool = False , * ,
2254
+ blocker : bool = False ) -> None :
2254
2255
if (not serious and
2255
2256
not self .check_untyped_defs and
2256
2257
self .function_stack and
2257
2258
self .function_stack [- 1 ].is_dynamic ()):
2258
2259
return
2259
- self .errors .report (ctx .get_line (), msg )
2260
+ self .errors .report (ctx .get_line (), msg , blocker = blocker )
2260
2261
2261
2262
def note (self , msg : str , ctx : Context ) -> None :
2262
2263
if (not self .check_untyped_defs and
0 commit comments