-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow "rethrow" to end a switch case #27650
Comments
See also #21822 |
The current specification is too restrictive to be really helpful. Personally, I would just remove the warning and the throw at the end of switch cases, and just break the switch when a case's statements end. Simpler for everybody, except those that expect fall-through, they won't get any warnings. |
In the long term I agree with Lasse. |
Also see #7537 |
Add `rethrow` as one of the statements that are allowed to end a switch case without a warning. Change wording to not claim that `throw` is a statement. Also allow wrapping case statements in a block statement without causing more warnings. Currently, a `case 4: { break; }` is required to warn because the last statement is a block statement, not a break statement. Fixes issue #27650 BUG= http://dartbug.com/27650 R=eernst@google.com, floitsch@google.com, rnystrom@google.com Review URL: https://codereview.chromium.org/2447613003 .
This is fixed in the spec, but have the implementations implemented it? Have we documented it? Written tests? |
Groovy, thanks! |
Here's a goofy corner of the language:
Analyzer reports:
This is correct. The spec does not mention allow
rethrow
to end a clause. It probably should?The text was updated successfully, but these errors were encountered: