Skip to content

Commit

Permalink
Make break/continue exprs not-nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
RblSb committed Jul 3, 2023
1 parent 83b6412 commit c3f4b3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/typing/nullSafety.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,8 @@ class expr_checker mode immediate_execution report =
| TMeta (_, e) -> self#is_nullable_expr e
| TThrow _ -> false
| TReturn _ -> false
| TContinue -> false
| TBreak -> false
| TBinop ((OpAssign | OpAssignOp _), _, right) -> self#is_nullable_expr right
| TBlock exprs ->
local_safety#block_declared;
Expand Down
7 changes: 7 additions & 0 deletions tests/nullsafety/src/cases/TestLoose.hx
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,11 @@ class TestLoose {
}
shouldFail(if (foo()) {});
}

static function nullCoal_continue_shouldPass():Void {
for (i in 0...1) {
var i:String = staticVar ?? continue;
var i2:String = staticVar ?? break;
}
}
}

0 comments on commit c3f4b3b

Please sign in to comment.