Make missing break for non-empty case clauses a compile time error #2300
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-duplicate
Closed in favor of an existing report
type-enhancement
A request for a change that isn't a bug
Currently if you have a missing break from a non-empty case clause, a runtime exception will be thrown. This behavior is surprising to developers, who don't expect the omission of required syntax to throw runtime exceptions. Instead, they expect the feedback to be giving at compile time, and by the tools during static analysis.
If we are not holistically re-evaluating switch/case then I suggest as a "baby step" we make the omission of a break in a non-empty case clause a compile time error. Let's catch this syntactic omission early.
The text was updated successfully, but these errors were encountered: