#!stacks
"panicdottypeI" && "inline.(*state).inlineCall:+370"
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)
}
}()
}
golang.org/x/tools/gopls@v0.18.1 go1.23.5 darwin/arm64 vscode (2)
Issue created by stacks.
The fix is to do something like what gopls does in gopls/internal/golang/inline.go, but in the
inlinepackage itself so that all callers (e.g. ChangeSignature) benefit:This stack
nlN-6wwas reported by telemetry:crash/crashruntime.gopanic:+69runtime.panicdottypeE:=275runtime.panicdottypeI:+5golang.org/x/tools/internal/refactor/inline.(*state).inlineCall:+370golang.org/x/tools/internal/refactor/inline.(*state).inline:+17golang.org/x/tools/internal/refactor/inline.Inline:+13golang.org/x/tools/gopls/internal/golang.inlineAllCalls:+171golang.org/x/tools/gopls/internal/golang.rewriteCalls:+118golang.org/x/tools/gopls/internal/golang.ChangeSignature:+142golang.org/x/tools/gopls/internal/server.(*commandHandler).ChangeSignature.func1:+15golang.org/x/tools/gopls/internal/server.(*commandHandler).run.func2:+3golang.org/x/tools/gopls/internal/server.(*commandHandler).run:+81golang.org/x/tools/gopls/internal/server.(*commandHandler).ChangeSignature:+2golang.org/x/tools/gopls/internal/protocol/command.Dispatch:+45golang.org/x/tools/gopls/internal/server.(*server).ResolveCodeAction:+21golang.org/x/tools/gopls/internal/protocol.serverDispatch:+46golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5