Skip to content

Commit 449c585

Browse files
committed
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]>
1 parent 1c1ec42 commit 449c585

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
@@ -248,9 +248,6 @@ func searchForEnclosing(info *types.Info, path []ast.Node) types.Type {
248248
}
249249
}
250250
}
251-
if exported == nil {
252-
return nil
253-
}
254251
return exported
255252
}
256253
case *ast.CompositeLit:

0 commit comments

Comments
 (0)