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 #43680

Closed
griesemer opened this issue Jan 13, 2021 · 5 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. label Jan 13, 2021
@griesemer griesemer added this to the Go1.17 milestone Jan 13, 2021
@griesemer griesemer self-assigned this Jan 13, 2021
@gopherbot
Copy link

Change https://golang.org/cl/283475 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
Reviewed-on: https://go-review.googlesource.com/c/go/+/283475
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/291321 mentions this issue: [dev.typeparams] go/types: better error message for invalid ... use

gopherbot pushed a commit that referenced this issue Feb 12, 2021
This is a port of CL 283475 to go/types.

For #43680

Change-Id: Ida630651247a40e28d405594394476e346354866
Reviewed-on: https://go-review.googlesource.com/c/go/+/291321
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
@griesemer griesemer changed the title cmd/compile: better error messages for use of ... with type parameters (dev.typeparams branch) cmd/compile: better error messages for use of ... with type parameters Mar 3, 2021
@findleyr
Copy link
Contributor

findleyr commented Mar 5, 2021

@griesemer is there anything left here now that we've merged?

@griesemer
Copy link
Contributor Author

@findleyr I'd like to keep it open for now. I'm still wondering if this shouldn't be a syntax error.

@griesemer griesemer modified the milestones: Go1.17, Go1.18 Apr 14, 2021
@griesemer
Copy link
Contributor Author

Closing this. What we have seems fine for now. We can always reconsider if people stumble of this.

@golang golang locked and limited conversation to collaborators Jun 23, 2023
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.
Projects
None yet
Development

No branches or pull requests

3 participants