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/internal/syntax: unclear error message for function type have type parameters #48382

Closed
cuonglm opened this issue Sep 14, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@cuonglm
Copy link
Member

cuonglm commented Sep 14, 2021

What version of Go are you using (go version)?

$ go version
go version devel go1.18-ee91bb8319 Tue Sep 14 02:53:17 2021 +0000 darwin/arm64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

Compile this program:

package p

type I func[T any]()

What did you expect to see?

Friendly error message, like gotype:

$ gotype p.go
p.go:3:12: function type cannot have type parameters

What did you see instead?

$ go tool compile p.go
p.go:3:15: syntax error: unexpected any, expecting ]

cc @griesemer @findleyr

@cuonglm cuonglm added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 14, 2021
@cuonglm cuonglm added this to the Go1.18 milestone Sep 14, 2021
@cuonglm cuonglm changed the title cmd/compile/internal/syntax cmd/compile/internal/syntax: unclear error message for function type have type parameters Sep 14, 2021
@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 14, 2021
@griesemer griesemer self-assigned this Sep 14, 2021
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 14, 2021
@griesemer
Copy link
Contributor

griesemer commented Sep 14, 2021

The fix is not hard but it's also subtle due to the way func type parsing is used in various places. If we address this, it needs to be a comprehensive fix which requires some careful parser changes.

This looks straight-forward to address, after all.

Not urgent.

@gopherbot
Copy link

Change https://golang.org/cl/361259 mentions this issue: cmd/compile/internal/syntax: better error message when type parameters are not permitted

@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