Skip to content
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

Switch specification doesn't match implementation. #2354

Closed
lrhn opened this issue Mar 30, 2012 · 6 comments
Closed

Switch specification doesn't match implementation. #2354

lrhn opened this issue Mar 30, 2012 · 6 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@lrhn
Copy link
Member

lrhn commented Mar 30, 2012

Implementations of switch currently throw an exception if a case (except the last one) reaches the end of the case body, i.e., where someone might mistakenly expect a fallthrough.

The specification doesn't say that this should happen, but instead just lets execution continue after the switch.

There doesn't seem to be consensus on which behavior is correct.

@iposva-google
Copy link
Contributor

Gilad, please clarify.


cc @kasperl.
Set owner to @gbracha.

@gbracha
Copy link
Contributor

gbracha commented Apr 12, 2012

I expect we'll change the spec shortly; the open question has been "to what?".


Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented Apr 12, 2012

Issue #2300 has been merged into this issue.

@gbracha
Copy link
Contributor

gbracha commented Apr 12, 2012

Issue #2047 has been merged into this issue.

@DartBot
Copy link

DartBot commented Apr 13, 2012

This comment was originally written by kajmagn...@gmail.com


+1 for not requiring "break;"

Change the spec to what? What about this:

case 1: ... code ...
case 2: ... code ...
case 3: ... code ...
case 4,
case 5,
case 6: ... code ...

Since 4 & 5 are followed by ',' and are empty, they fall through to case 6:.

(And perhaps ``case X:'' followed by nothing would be an error)

Kind regards, KajMagnus

@gbracha
Copy link
Contributor

gbracha commented May 2, 2012

Fixe din 0.09 draft


Added Done label.

@lrhn lrhn added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels May 2, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

5 participants