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/ast: add func Unparen(Expr) Expr #60061

Closed
adonovan opened this issue May 8, 2023 · 5 comments
Closed

go/ast: add func Unparen(Expr) Expr #60061

adonovan opened this issue May 8, 2023 · 5 comments

Comments

@adonovan
Copy link
Member

adonovan commented May 8, 2023

Almost every application that uses go/ast needs a function to strip parens. There are 4 copies of unparen in the standard library. golang.org/x/tools has astutil.Unparen. I propose we add this function to go/ast.

package ast // import "go/ast"

// Unparen returns e with any enclosing parentheses stripped.
func Unparen(e Expr) Expr

See https://go.dev/cl/495315 for the implementation.

@adonovan adonovan added this to the Proposal milestone May 8, 2023
@adonovan adonovan moved this to Incoming in Proposals May 8, 2023
@ianlancetaylor ianlancetaylor changed the title go/ast: add 'func Unparen(Expr) Expr' proposal: go/ast: add 'func Unparen(Expr) Expr' May 9, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/495315 mentions this issue: go/ast: add Unparen(Expr) helper

@rsc
Copy link
Contributor

rsc commented May 17, 2023

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc rsc moved this from Incoming to Likely Accept in Proposals May 17, 2023
@rsc
Copy link
Contributor

rsc commented May 24, 2023

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc moved this from Likely Accept to Accepted in Proposals May 24, 2023
@rsc rsc changed the title proposal: go/ast: add 'func Unparen(Expr) Expr' go/ast: add 'func Unparen(Expr) Expr' May 24, 2023
@rsc rsc modified the milestones: Proposal, Backlog May 24, 2023
@rsc rsc changed the title go/ast: add 'func Unparen(Expr) Expr' go/ast: add func Unparen(Expr) Expr May 24, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/548882 mentions this issue: doc/go1.22: document ast.Unparen

gopherbot pushed a commit that referenced this issue Dec 12, 2023
Updates #60061

Change-Id: Ifa51f0bac0346ebc352c7524204aa94336a2b5ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/548882
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
Updates golang#60061

Change-Id: Ifa51f0bac0346ebc352c7524204aa94336a2b5ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/548882
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
@rsc rsc removed this from Proposals Jul 25, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/612038 mentions this issue: x/tools: deprecate astutil.Unparen

gopherbot pushed a commit to golang/tools that referenced this issue Sep 9, 2024
The go1.22 go/ast package now provides it.

Updates golang/go#60061

Change-Id: I24e201660e3a8752dd505eefc894c7acae4c99f3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612038
Auto-Submit: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@dmitshur dmitshur modified the milestones: Backlog, Go1.22 Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants