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
The definition of terminating statement does not include exhaustive switches over finite data types. Maybe it could, but it can get tricky. What about this:
x := true
y := false
switch val {
case x: return nil
case y: return nil
}
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The following piece of code does not compile, even though all possible values of given type are handled in cases and return.
See https://play.golang.org/p/gUjEufse8gF
Adding a
default
case that returns makes the code compile too.What did you expect to see?
no errors
What did you see instead?
The text was updated successfully, but these errors were encountered: