-
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, go/parser: cannot parse certain constraint literals in generic types #49175
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
Milestone
Comments
This affects go/parser as well. |
Another case:
|
Change https://golang.org/cl/359134 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Oct 28, 2021
Now that we allow eliding 'interface' from constraint types, we need to be a bit more careful about not consuming a '[' when parsing the next expression after "type T [". We want to check if the next expression is an identifier not followed by ']', in which case we're in a generic type, but need to avoid parsing index or slice expressions. Such expressions aren't valid array lengths because these expressions are never constant, so when encountering a following '[' we can instead assume that this is a type parameter field with array or slice type constraint. Test cases are added for the related issues #49174 and #49175, along with a flag to enable tracing error tests. For #49174 For #49175 Change-Id: I0476ef20c4c134ac537118272f20caaf123ee70e Reviewed-on: https://go-review.googlesource.com/c/go/+/359134 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Change https://golang.org/cl/360135 mentions this issue: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
The following generic type declaration cannot be parsed:
Not a release blocker because the typical
is accepted.
See also #49174 .
The text was updated successfully, but these errors were encountered: