Skip to content

Commit fcb4185

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/golang: fix bug browsing assembly for (T).f methods
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]>
1 parent 28cd718 commit fcb4185

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gopls/internal/golang/codeaction.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -815,12 +815,12 @@ func goAssembly(ctx context.Context, req *codeActionsRequest) error {
815815
sym.WriteString(".")
816816
if sig.Recv() != nil {
817817
if isPtr, named := typesinternal.ReceiverNamed(sig.Recv()); named != nil {
818-
sym.WriteString("(")
819818
if isPtr {
820-
sym.WriteString("*")
819+
fmt.Fprintf(&sym, "(*%s)", named.Obj().Name())
820+
} else {
821+
sym.WriteString(named.Obj().Name())
821822
}
822-
sym.WriteString(named.Obj().Name())
823-
sym.WriteString(").")
823+
sym.WriteByte('.')
824824
}
825825
}
826826
sym.WriteString(fn.Name())

0 commit comments

Comments
 (0)