Closed
Description
#!stacks
"sigpanic" && "inlineVariableOne-range1"
Issue created by stacks.
id := curIdent.Node().(*ast.Ident)
obj1 := info.Uses[id]
_, obj2 := scope.LookupParent(id.Name, pos)
if obj1 != obj2 {
return nil, nil, fmt.Errorf("cannot inline variable: its initializer expression refers to %q, which is shadowed by the declaration at line %d", id.Name, safetoken.Position(pgf.Tok, obj2.Pos()).Line) // <----------- obj2 is nil
}
This stack tdbvkw
was reported by telemetry:
crash/crash
runtime.gopanic:+69,+0x14f
runtime.panicmem:=262,+0x2e7
runtime.sigpanic:+19,+0x2b8
golang.org/x/tools/gopls/internal/golang.inlineVariableOne-range1:+8,+0x124
golang.org/x/tools/go/ast/inspector.Cursor.Preorder.func1:+6,+0xbb
golang.org/x/tools/gopls/internal/golang.inlineVariableOne:+13,+0x28f
golang.org/x/tools/gopls/internal/golang.ApplyFix.singleFile.func6:+1,+0x33
golang.org/x/tools/gopls/internal/golang.ApplyFix:+43,+0x6db
golang.org/x/tools/gopls/internal/server.(*commandHandler).ApplyFix.func1:+1,+0x67
golang.org/x/tools/gopls/internal/server.(*commandHandler).run.func2:+3,+0x6f
golang.org/x/tools/gopls/internal/server.(*commandHandler).run:+81,+0x407
golang.org/x/tools/gopls/internal/server.(*commandHandler).ApplyFix:+2,+0x11b
golang.org/x/tools/gopls/internal/protocol/command.Dispatch:+31,+0x907
golang.org/x/tools/gopls/internal/server.(*server).ResolveCodeAction:+21,+0x167
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+46,+0xa5b
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func4:+5,+0x6f
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func5:+52,+0x637
golang.org/x/tools/gopls@v0.19.1 go1.25rc1 darwin/arm64 other,vscode (3)