We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For
package main func _() { var a struct{ _ func() } switch a { } }
the compiler reports
main.go:5:2: cannot switch on a (type struct { _ func() }) (struct containing func() cannot be compared)
go/types and types2 don't report an error.
go/types
types2
var a struct{ _ func() } switch a { case a: }
go/types and types2 report an error with case a:
case a
main.go:6:7: cannot compare a == a (operator == not defined for struct{_ func()})
Empty switches like this are unlikely, but we should report an error at the top (and than avoid the respective errors for the cases).
cc: @findleyr
The text was updated successfully, but these errors were encountered:
Change https://golang.org/cl/278132 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: report error for invalid (but empty) expr switch
[dev.typeparams] cmd/compile/internal/types2: report error for invalid (but empty) expr switch
Sorry, something went wrong.
[dev.typeparams] cmd/compile/internal/types2: report error for invali…
14e4267
…d (but empty) expr switch Enable one more errorcheck test. Updates #43110. Updates #43200. Change-Id: Ib7b971d5e9989c65320579f75d65266bbbbeec53 Reviewed-on: https://go-review.googlesource.com/c/go/+/278132 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Change https://golang.org/cl/278813 mentions this issue: go/types: report error for invalid (but empty) expr switch
go/types: report error for invalid (but empty) expr switch
b0f01e1
No branches or pull requests
For
the compiler reports
go/types
andtypes2
don't report an error.For
go/types
andtypes2
report an error withcase a
:Empty switches like this are unlikely, but we should report an error at the top (and than avoid the respective errors for the cases).
cc: @findleyr
The text was updated successfully, but these errors were encountered: