-
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: confusing error message when using an indexing expression as an array size #60812
Comments
It looks the current implementation tries to think the only item in
|
CC @griesemer |
Change https://go.dev/cl/538856 mentions this issue: |
Change https://go.dev/cl/538858 mentions this issue: |
This is a port of CL 538856 from the syntax parser to go/parser. As part of the port, make more portions of parseParameterList matching the equivalent paramList method (from the syntax parser). As a result, this now also produces a better error message in cases where the missing piece might not be a type parameter name but a constraint (this fixes a TODO in a test). Improve comments in the code and adjust the corresponding comments in the syntax parser. Change references to issues to use the format go.dev/issue/ddddd. For #60812. Change-Id: Ia243bd78161ed8543d3dc5deb20ca4a215c5b1e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/538858 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
syntax error: array length must be a constant
or
syntax error: type constraint is incomplete
or
syntax error: either type constraint is incomplete or array length is not a constant
What did you see instead?
syntax error: type parameters must be named
The text was updated successfully, but these errors were encountered: