Skip to content

Commit

Permalink
[gopls-release-branch.0.4] internal/lsp: properly check for nil on i.…
Browse files Browse the repository at this point in the history
…enclosing

Fixes golang/go#40479

Change-Id: If827a86fd603574d3adde295c1165bb6267732eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245486
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
(cherry picked from commit 449c585)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245538
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
  • Loading branch information
stamblerre committed Jul 29, 2020
1 parent 0fc8b43 commit dc9b9f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion internal/lsp/source/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func pathLinkAndSymbolName(i *IdentifierInfo) (string, string, string) {
// exported (we may have an interface or struct we can link
// to). If not, don't show any link.
if !rtyp.Obj().Exported() {
if named := i.enclosing.(*types.Named); ok && named.Obj().Exported() {
if named, ok := i.enclosing.(*types.Named); ok && named.Obj().Exported() {
rTypeName = named.Obj().Name()
} else {
return "", "", ""
Expand Down
3 changes: 0 additions & 3 deletions internal/lsp/source/identifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ func searchForEnclosing(info *types.Info, path []ast.Node) types.Type {
}
}
}
if exported == nil {
return nil
}
return exported
}
case *ast.CompositeLit:
Expand Down

0 comments on commit dc9b9f8

Please sign in to comment.