Skip to content
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: better error messages for use of ... with type parameters (dev.typeparams branch) #43680

griesemer opened this issue Jan 13, 2021 · 1 comment


Copy link

@griesemer griesemer commented Jan 13, 2021

For main.go:

package p
func _[T ...any]() {}

The compiler reports

main.go:2:10: ...any is not a type
main.go:2:10: invalid use of '...'

with go tool compile -G main.go.

The error messages should be better. ... should not be permitted for type parameters during parsing.

@griesemer griesemer added the NeedsFix label Jan 13, 2021
@griesemer griesemer added this to the Go1.17 milestone Jan 13, 2021
@griesemer griesemer self-assigned this Jan 13, 2021
Copy link

@gopherbot gopherbot commented Jan 14, 2021

Change mentions this issue: [dev.typeparams] cmd/compile/internal/types2: better error message for invalid ... use

gopherbot pushed a commit that referenced this issue Jan 14, 2021
…r invalid ... use

This partially addresses the issue below: In many (all) cases we want to
handle invalid ... use in the parser as a syntax error; but this ensures
that we get a decent error if we get here anyway.

Updates #43680.

Change-Id: I93af43a5f5741d8bc76e7a13c0db75e6edf43111
Trust: Robert Griesemer <>
Reviewed-by: Robert Findley <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.