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
Assignees
Labels
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Apr 26, 2021

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 this to the Backlog milestone Apr 26, 2021
@griesemer
Copy link
Contributor

@griesemer 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.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 26, 2021

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

Loading

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

@findleyr findleyr commented Apr 29, 2021

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

Loading

@findleyr findleyr closed this Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants