Skip to content

cmd/compile/internal/syntax: unclear error message for function type have type parameters #48382

@cuonglm

Description

@cuonglm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions