You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Checker.selector, when types2 constructs the Signature to represent a method expression, it creates a receiver variable with no position, the current package, and "_" as the variable name. I think it would be better to reuse this information from sig.recv for consistency with the rest of the parameters.
One catch appears to be that sig.recv may be nil at least in some invalid source files (e.g., the straightforward change to use it led to crashes in some of the types2 regress tests). I expect though that no valid code would have this problem (otherwise the rest of the parameters would be wrong too). Maybe if sig.recv is nil, we should just bail with goto Error?
…hod expressions
When synthesizing the Signature to represent a method expression, keep
as much of the original parameter as possible, substituting only the
receiver type.
Fixes#46209.
Change-Id: Ic4531820ae7d203bb0ba25a985f72d219b4aa25f
Reviewed-on: https://go-review.googlesource.com/c/go/+/320489
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This is a port of CL 320489 to go/types, adjusted to be consistent about
named/unnamed parameters. TestEvalPos was failing without this addition.
For #46209
Change-Id: Icdf86e84ebce8ccdb7846a63b5605e360e2b8781
Reviewed-on: https://go-review.googlesource.com/c/go/+/324733
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
In Checker.selector, when types2 constructs the Signature to represent a method expression, it creates a receiver variable with no position, the current package, and "_" as the variable name. I think it would be better to reuse this information from
sig.recv
for consistency with the rest of the parameters.One catch appears to be that
sig.recv
may benil
at least in some invalid source files (e.g., the straightforward change to use it led to crashes in some of the types2 regress tests). I expect though that no valid code would have this problem (otherwise the rest of the parameters would be wrong too). Maybe ifsig.recv
is nil, we should just bail withgoto Error
?/cc @griesemer @findleyr
The text was updated successfully, but these errors were encountered: