Skip to content

Commit dc9b9f8

Browse files
committed
[gopls-release-branch.0.4] internal/lsp: properly check for nil on i.enclosing
Fixes golang/go#40479 Change-Id: If827a86fd603574d3adde295c1165bb6267732eb Reviewed-on: https://go-review.googlesource.com/c/tools/+/245486 Run-TryBot: Rebecca Stambler <[email protected]> Reviewed-by: Robert Findley <[email protected]> (cherry picked from commit 449c585) Reviewed-on: https://go-review.googlesource.com/c/tools/+/245538 TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Cottrell <[email protected]>
1 parent 0fc8b43 commit dc9b9f8

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

internal/lsp/source/hover.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func pathLinkAndSymbolName(i *IdentifierInfo) (string, string, string) {
166166
// exported (we may have an interface or struct we can link
167167
// to). If not, don't show any link.
168168
if !rtyp.Obj().Exported() {
169-
if named := i.enclosing.(*types.Named); ok && named.Obj().Exported() {
169+
if named, ok := i.enclosing.(*types.Named); ok && named.Obj().Exported() {
170170
rTypeName = named.Obj().Name()
171171
} else {
172172
return "", "", ""

internal/lsp/source/identifier.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ func searchForEnclosing(info *types.Info, path []ast.Node) types.Type {
256256
}
257257
}
258258
}
259-
if exported == nil {
260-
return nil
261-
}
262259
return exported
263260
}
264261
case *ast.CompositeLit:

0 commit comments

Comments
 (0)