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

go/parser: parser doesn't accept trailing comma where it should #56748

Closed
griesemer opened this issue Nov 15, 2022 · 2 comments
Closed

go/parser: parser doesn't accept trailing comma where it should #56748

griesemer opened this issue Nov 15, 2022 · 2 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@griesemer
Copy link
Contributor

package p

type S[T1 any, T2 any] struct {
	v1 T1
	v2 T2
}

type S1 struct {
	S[byte, []byte] // ok
}

type S2 struct {
	S[byte, []byte,] // not ok: trailing comma not accepted even though it is legal
}

leads to a syntax error when parsed with go/parser. In the playground, the program cannot be formatted (but it can be compiled and run because the compiler uses a different parser).

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Nov 15, 2022
@griesemer griesemer added this to the Go1.20 milestone Nov 15, 2022
@griesemer
Copy link
Contributor Author

See CL 450175.

@griesemer griesemer self-assigned this Nov 15, 2022
@gopherbot
Copy link

Change https://go.dev/cl/450175 mentions this issue: go/parser: allow trailing commas in embedded instantiated types

@golang golang locked and limited conversation to collaborators Nov 17, 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. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants