You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem. Thanks.
What steps will reproduce the problem?
1. Read the spec
2. Try the code, just to be sure: both gofmt and 8g reject it
What is the expected output? What do you see instead?
In spec, expected:
switch x := f(); { // missing switch expression means "true"
case x < 0: return -x
default: return x
}
Found:
switch x := f() { // missing switch expression means "true"
case x < 0: return -x
default: return x
}
http://golang.org/doc/go_spec.html#Switch_statements
What is your $GOOS? $GOARCH?
linux 386
Which revision are you using? (hg identify)
cf3701cfac15 tip
Please provide any additional information below.
Unless the implementation is wrong, and you are supposed to be able to
elide the ';' after the simple statement (though this seems unlikely).
Either way, there's a discord.
The text was updated successfully, but these errors were encountered:
The spec describes the switch statement as:
ExprSwitchStmt = "switch" [ SimpleStmt ";" ] [ Expression ] "{" { ExprCaseClause } "}" .
so the example without the semicolon is wrong.
The text was updated successfully, but these errors were encountered: