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: incorrectly allows parenthesized embedded types #51655

Closed
findleyr opened this issue Mar 14, 2022 · 5 comments
Closed

go/parser: incorrectly allows parenthesized embedded types #51655

findleyr opened this issue Mar 14, 2022 · 5 comments
Assignees
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@findleyr
Copy link
Contributor

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

$ go version
go version go1.17.8 linux/amd64

Does this issue reproduce with the latest release?

Yes, and at tip.

What did you do?

https://go.dev/play/p/xOwV_SZwGCU

Parsed this

package p

type I1 interface{}

type I2 struct{ (I1) }

What did you expect to see?

An error

What did you see instead?

No error

I believe in the process of adding support for generics, we accidentally dropped this error. This has been present since at least Go 1.17, so (IMO) should be OK to fix in a patch release of Go 1.18, backported to Go 1.17.

CC @griesemer

@findleyr findleyr added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 14, 2022
@findleyr findleyr modified the milestones: Go1.18, Go1.19 Mar 14, 2022
@griesemer
Copy link
Contributor

The compiler correctly reports this error, so I am not too concerned about the need for back-porting. Actually running code won't have this error.

@ianlancetaylor
Copy link
Contributor

What is the current status here? This issue is currently in the 1.19 milestone. Should it move to 1.20? To Backlog? Thanks.

@griesemer
Copy link
Contributor

I think we should fix this but it doesn't need to be fixed for 1.19. Moving to 1.20.

@griesemer griesemer modified the milestones: Go1.19, Go1.20 Jun 24, 2022
@griesemer griesemer added the early-in-cycle A change that should be done early in the 3 month dev cycle. label Aug 18, 2022
@griesemer
Copy link
Contributor

Once this is fixed, address the respective TODO in go/types/testdata/examples/types.go.

@gopherbot
Copy link

Change https://go.dev/cl/424694 mentions this issue: go/parser: disallow parenthesizing embedded types in structs

@golang golang locked and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
Development

No branches or pull requests

4 participants