-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: confusing behaviour of Selection.Indirect() for Kind()==MethodVal #8353
Comments
I'm not sure we can change this at this point. @adonovan please comment on this issue, or close otherwise. Thanks. |
I just stumbled into this again:
I think this is a definite bug but I agree it may be too late to change things without introducing much more subtle bugs. I'll make a doc change to Selection. |
Change https://go.dev/cl/533935 mentions this issue: |
Updates #8353 Change-Id: I80cdbfccb8f7db00e04c293a68aaebc7c71bbbe9 Reviewed-on: https://go-review.googlesource.com/c/go/+/533935 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Is it not possible to swap the behavior depending on the language version, kinda like we're doing with range variable scopes? It might not be worth the hassle, but presumably this can't be riskier than changing the semantics of range loops. |
I would rather just add a new method and deprecate the old one. The correct behavior can be computed from the Selection alone using logic like this (from https://go.dev/cl/533156):
|
Agree that we should create a new method and deprecate the old one. Since we keep stumbling into this, can we elevate this issue to a proposal and get it done? I suggest |
I think that makes sense if we can get the type checker to compute the correct value of IsIndirect; I'd rather not just bolt my relatively expensive workaround onto the existing implementation. So that means it's mostly a type checker implementation task. |
I'm sure the type checker can compute the correct value and store it in Is there any objection to making this a proposal, so that we can finally close this bug? |
Updates golang#8353 Change-Id: I80cdbfccb8f7db00e04c293a68aaebc7c71bbbe9 Reviewed-on: https://go-review.googlesource.com/c/go/+/533935 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The text was updated successfully, but these errors were encountered: