x/tools/gopls: crash in signature help on error.Error
Closed this issue · 1 comments
adonovan commented
This test case (synthesized after investigating a telemetry-reported stack) seems to trigger a panic:
func _(err error) {
err.Error() //@signature(")", "Error()", 0)
}
panic: xtools/gopls/internal/lsp/source/hover.go:823: internal error: no file for position 0
goroutine 33750 [running]:
testing.tRunner.func1.2({0x104e7b060, 0x1400acd9d80})
/Users/adonovan/w/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1545 +0x1c8
testing.tRunner.func1()
/Users/adonovan/w/homebrew/Cellar/go/1.21.3/libexec/src/testing/testing.go:1548 +0x360
panic({0x104e7b060?, 0x1400acd9d80?})
/Users/adonovan/w/homebrew/Cellar/go/1.21.3/libexec/src/runtime/panic.go:914 +0x218
golang.org/x/tools/gopls/internal/bug.report({0x14007255470, 0x26})
xtools/gopls/internal/bug/bug.go:80 +0x474
golang.org/x/tools/gopls/internal/bug.Errorf({0x104bd4405?, 0x1057cca68?}, {0x140036519e8?, 0x10465eb34?, 0x1400ac243a8?})
xtools/gopls/internal/bug/bug.go:58 +0x3c
golang.org/x/tools/gopls/internal/lsp/source.parseFull({0x104fdf930, 0x1400e8a0d50}, {0x104fe9568, 0x140047e3040}, 0x14005523580?, 0x0)
xtools/gopls/internal/lsp/source/hover.go:823 +0x1f0
golang.org/x/tools/gopls/internal/lsp/source.HoverDocForObject({0x104fdf930, 0x1400e8a0d50}, {0x104fe9568, 0x140047e3040}, 0x1400015fc00?, {0x104fe5098?, 0x140000924e0?})
xtools/gopls/internal/lsp/source/hover.go:770 +0xb0
golang.org/x/tools/gopls/internal/lsp/source.SignatureHelp({0x104fdf930?, 0x1400e8a0b70?}, {0x104fe9568?, 0x140047e3040?}, {0x104fe0290, 0x1400056b7a0}, {0x5bd400?, 0x140?})
xtools/gopls/internal/lsp/source/signature_help.go:100 +0x640
golang.org/x/tools/gopls/internal/lsp.(*Server).signatureHelp(0x1400fc3d3e0?, {0x104fdf930, 0x14000112ed0}, 0x14003651e58)
xtools/gopls/internal/lsp/signature_help.go:25 +0x180
golang.org/x/tools/gopls/internal/lsp.(*Server).SignatureHelp(...)
xtools/gopls/internal/lsp/server_gen.go:268
golang.org/x/tools/gopls/internal/lsp.(*runner).SignatureHelp(0x1400037e240, 0x1400bdd81a0, {{{0x140005bd400, 0x71}, {0x58, 0xc, 0xb50}, {0x58, 0xd, 0xb51}}}, ...)
xtools/gopls/internal/lsp/lsp_test.go:587 +0x1b4
golang.org/x/tools/gopls/internal/lsp/tests.Run.func15.1(0x1400bdd81a0)
xtools/gopls/internal/lsp/tests/tests.go:601 +0x8c
gopherbot commented
Change https://go.dev/cl/535875 mentions this issue: gopls/internal/lsp: fix signature crash on error.Error