-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins
Milestone
Description
#!stacks
"panicdottypeI" && "inline.(*state).inlineCall:+370"
Issue created by stacks.
// simplify decl: func(T...) -> func([]T)
lastParamField := last(calleeDecl.Type.Params.List)
lastParamField.Type = &ast.ArrayType{
Elt: lastParamField.Type.(*ast.Ellipsis).Elt, <---- panicdottypeI
}
The fix is to do something like what gopls does in gopls/internal/golang/inline.go, but in the inline
package itself so that all callers (e.g. ChangeSignature) benefit:
// The inliner assumes that input is well-typed,
// but that is frequently not the case within gopls.
// Until we are able to harden the inliner,
// report panics as errors to avoid crashing the server.
bad := func(p *cache.Package) bool { return len(p.ParseErrors())+len(p.TypeErrors()) > 0 }
if bad(calleePkg) || bad(callerPkg) {
defer func() {
if x := recover(); x != nil {
err = fmt.Errorf("inlining failed (%q), likely because inputs were ill-typed", x)
}
}()
}
This stack nlN-6w
was reported by telemetry:
crash/crash
runtime.gopanic:+69
runtime.panicdottypeE:=275
runtime.panicdottypeI:+5
golang.org/x/tools/internal/refactor/inline.(*state).inlineCall:+370
golang.org/x/tools/internal/refactor/inline.(*state).inline:+17
golang.org/x/tools/internal/refactor/inline.Inline:+13
golang.org/x/tools/gopls/internal/golang.inlineAllCalls:+171
golang.org/x/tools/gopls/internal/golang.rewriteCalls:+118
golang.org/x/tools/gopls/internal/golang.ChangeSignature:+142
golang.org/x/tools/gopls/internal/server.(*commandHandler).ChangeSignature.func1:+15
golang.org/x/tools/gopls/internal/server.(*commandHandler).run.func2:+3
golang.org/x/tools/gopls/internal/server.(*commandHandler).run:+81
golang.org/x/tools/gopls/internal/server.(*commandHandler).ChangeSignature:+2
golang.org/x/tools/gopls/internal/protocol/command.Dispatch:+45
golang.org/x/tools/gopls/internal/server.(*server).ResolveCodeAction:+21
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+46
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/[email protected] go1.23.5 darwin/arm64 vscode (2)
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/telemetry-wins