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/types: ignore function literal bodies if IgnoreFuncBodies is set #45783

Closed
findleyr opened this issue Apr 26, 2021 · 3 comments
Closed

go/types: ignore function literal bodies if IgnoreFuncBodies is set #45783

findleyr opened this issue Apr 26, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@findleyr
Copy link
Contributor

The Config.IgnoreFuncBodies setting causes go/types to skip checking function bodies for function declarations, but not function literals. This is surprising, and probably just an oversight as function literals are rare outside of function bodies. @heschi noticed this while working on some gopls optimizations.

Not urgent, since AFAICT nobody has complained in 5+ years, but if we decide this should be corrected the fix is of course trivial.

CC @griesemer

@findleyr findleyr added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Apr 26, 2021
@findleyr findleyr added this to the Backlog milestone Apr 26, 2021
@griesemer
Copy link
Contributor

griesemer commented Apr 26, 2021

We should probably just fix that - I assume it's a simple if. I assume this can only happen for function literals used in package-level variable initializations with function literals, and perhaps contrived other top-level declarations using functions such as unsafe.Sizeof (or the like) which take function literal operands.

@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Apr 26, 2021
@gopherbot
Copy link

Change https://golang.org/cl/313650 mentions this issue: cmd/compile/internal/types2: respect IgnoreFuncBodies for function literals

gopherbot pushed a commit that referenced this issue Apr 26, 2021
…terals

Updates #45783.

Change-Id: Id552a60f262e2da62125acd6aec0901a82f5a29a
Reviewed-on: https://go-review.googlesource.com/c/go/+/313650
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@findleyr
Copy link
Contributor Author

This was resolved by the port to go/types: https://golang.org/cl/314631.

@golang golang locked and limited conversation to collaborators Apr 29, 2022
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