-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: panic compiling type switch with multiple nil cases #15898
Comments
https://go-review.googlesource.com/#/c/19813/1/src/cmd/compile/internal/gc/swt.go@609 comes back to haunt/save us. :) |
The fix if duplicate nils are ok is pretty easy. Change the
We might want some sort of condition around the |
CL https://golang.org/cl/23573 mentions this issue. |
https://go-review.googlesource.com/23573 for rejecting multiple nils. If we allow multiple nils, then yes I think the first nil clause needs to win. |
Nils are not constants and I don't think the spec says anything that says
|
Ok. I'll update my CL tomorrow. |
CL https://golang.org/cl/23580 mentions this issue. |
@josharian Per a discussion with @randall77 and @ianlancetaylor just now, we agreed that we should disallow duplicate nils. See also my comment in #15896. |
OK. Will leave CL 23573 up for review as-is, then. |
This is a regression from 1.6, probably caused by CL 19814. With Go 1.6 and before, it compiles quietly.
I'd like to make duplicate nil case clauses a compile time error. If that is ok (see #15896), then I can pull together a CL. If we want a smaller, less behavior-changing patch, I might leave this for @randall77.
The text was updated successfully, but these errors were encountered: