Skip to content

Commit

Permalink
gopls/internal/golang: fix bug browsing assembly for (T).f methods
Browse files Browse the repository at this point in the history
This change fixes a bug in the logic to construct symbol names
that match those produced by the compiler: nonpointer methods
should be "T.f" not "(T).f".

Tested interactively.

Fixes golang/go#70888

Change-Id: I2a9d68fffbc75cb9f3719b58968ca1297bcbd3cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/637255
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
  • Loading branch information
adonovan authored and gopherbot committed Dec 17, 2024
1 parent 28cd718 commit fcb4185
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gopls/internal/golang/codeaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,12 +815,12 @@ func goAssembly(ctx context.Context, req *codeActionsRequest) error {
sym.WriteString(".")
if sig.Recv() != nil {
if isPtr, named := typesinternal.ReceiverNamed(sig.Recv()); named != nil {
sym.WriteString("(")
if isPtr {
sym.WriteString("*")
fmt.Fprintf(&sym, "(*%s)", named.Obj().Name())
} else {
sym.WriteString(named.Obj().Name())
}
sym.WriteString(named.Obj().Name())
sym.WriteString(").")
sym.WriteByte('.')
}
}
sym.WriteString(fn.Name())
Expand Down

0 comments on commit fcb4185

Please sign in to comment.