Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: panic with 'instantiated ident not found' #63933

Open
ForrestLinjianLi opened this issue Nov 3, 2023 · 6 comments
Open

x/tools/gopls: panic with 'instantiated ident not found' #63933

ForrestLinjianLi opened this issue Nov 3, 2023 · 6 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. TypeInference Issue is related to generic type inference
Milestone

Comments

@ForrestLinjianLi
Copy link

gopls version: v0.14.1 (go1.21.3)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.21.3
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Fri, 03 Nov 2023 00:14:18 GMT
restart history:
Thu, 02 Nov 2023 19:11:31 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: instantiated ident not found

goroutine 9211 [running]:
go/types.(*Checker).handleBailout(0xc0002c9a40, 0xc006ff3578)
	  check.go:336  0x88
panic({0xdfb3c0%3F, 0x1220aa0%3F})
	  panic.go:914  0x21f
go/types.instantiatedIdent(...)
	  check.go:594
go/types.(*Checker).recordInstance(0x0%3F, {0x12292c0%3F, 0xc00af28dc0%3F}, {0xc00a09bca0%3F, 0xc00a09bca0%3F, 0x1%3F}, {0x1225f68%3F, 0xc0010c7740%3F})
	  check.go:570  0x1de
go/types.(*Checker).instantiateSignature(0xc0002c9a40, 0x17af6, {0x12292c0, 0xc00af28dc0}, 0xc0010c7700, {0xc00a09bca0, 0x1, 0x1}, {0x0, 0x0, ...})
	  call.go:153  0x2f9
go/types.(*Checker).arguments(0xc0002c9a40, 0xc00af28e40, 0xc0010137c0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc00c013350, ...}, ...)
	  call.go:635  0x15ea
go/types.(*Checker).callExpr(0xc0002c9a40, 0xc0010c7580, 0xc00af28e40)
	  call.go:302  0x86d
go/types.(*Checker).exprInternal(0xc0002c9a40, {0x0, 0x0}, 0xc0010c7580, {0x12292c0, 0xc00af28e40%3F}, {0x0%3F, 0x0%3F})
	  expr.go:1359  0x1809
go/types.(*Checker).rawExpr(0xc0002c9a40, {0x0, 0x0}, 0xc0010c7580, {0x12292c0%3F, 0xc00af28e40%3F}, {0x0%3F, 0x0%3F}, 0x0)
	  expr.go:965  0x1a5
go/types.(*Checker).multiExpr(0x678185%3F, {0x12292c0%3F, 0xc00af28e40}, 0x1)
	  expr.go:1517  0x85
go/types.(*Checker).initVars(0xe42ae0%3F, {0xc00a09bc20%3F, 0x2, 0x2}, {0xc00b705e20%3F, 0x1, 0x1}, {0x0, 0x0})
	  assignments.go:398  0x12c
go/types.(*Checker).shortVarDecl(0xc0002c9a40, {0x1223680, 0xc000aa3908}, {0xc008d696c0, 0x2, 0xc00af28800%3F}, {0xc00b705e20%3F, 0x1, 0x1})
	  assignments.go:546  0xbce
go/types.(*Checker).stmt(0xc0002c9a40, 0x0, {0x12293e0%3F, 0xc00af28e80%3F})
	  stmt.go:476  0xee5
go/types.(*Checker).stmtList(0xc0002c9a40%3F, 0x0, {0xc000faf900%3F, 0x0%3F, 0x120%3F})
	  stmt.go:124  0x85
go/types.(*Checker).funcBody(0xc0002c9a40, 0xc00b57ade0, {0xc00084a330%3F, 0xc000180c80%3F}, 0xc0010c4c40, 0xc000a92810, {0x0, 0x0})
	  stmt.go:44  0x345
go/types.(*Checker).funcDecl.func1()
	  decl.go:826  0x39
go/types.(*Checker).processDelayed(0xc0002c9a40, 0x0)
	  check.go:439  0x15c
go/types.(*Checker).checkFiles(0xc0002c9a40, {0xc00b3c7990, 0x1, 0x1})
	  check.go:383  0x245
go/types.(*Checker).Files(...)
	  check.go:341
golang.org/x/tools/gopls/internal/lsp/cache.doTypeCheck({0x122ae08, 0xc001fe30b0}, 0xc007d7fe60, {{0xc0006cd3b0, 0x43}, {0xc0006cd3b0, 0x43}, {0xc001652a88, 0x4}, {0xc00a9e1c40, ...}, ...})
	  check.go:1562  0x8a5
golang.org/x/tools/gopls/internal/lsp/cache.typeCheckImpl({0x122ae08, 0xc001fe2f30}, 0xc000d9a060%3F, {{0xc0006cd3b0, 0x43}, {0xc0006cd3b0, 0x43}, {0xc001652a88, 0x4}, {0xc00a9e1c40, ...}, ...})
	  check.go:1420  0x205
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackage(0xc00a309ed8%3F, {0x122ae08, 0xc0007dcab0}, 0xc00c022a20)
	  check.go:674  0x245
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).handleSyntaxPackage(0xc007d7fe60, {0x122ae08, 0xc0007dcab0}, 0xc0080e9e30%3F, {0xc0006cd3b0, 0x43})
	  check.go:532  0x42a
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).forEachPackageInternal.func2()
	  check.go:394  0x2b
golang.org/x/sync/errgroup.(*Group).Go.func1()
	  errgroup.go:75  0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 720
	  errgroup.go:72  0x96
[Error - 5:14:09 PM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

@hyangah
Copy link
Contributor

hyangah commented Nov 3, 2023

Thanks for the report! @ForrestLinjianLi

Transferring this to the main go repo for investigation. (cc @findleyr @adonovan)

@ForrestLinjianLi Is the code public so we can try? Otherwise, can you run the following command from your workspace folder and share the output?

gopls stats

@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: panic with 'instantiated ident not found' Nov 3, 2023
@hyangah hyangah transferred this issue from golang/vscode-go Nov 3, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 3, 2023
@gopherbot gopherbot added this to the Unreleased milestone Nov 3, 2023
@suzmue suzmue modified the milestones: Unreleased, gopls/v0.14.2 Nov 10, 2023
@suzmue suzmue added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 10, 2023
@adonovan
Copy link
Member

adonovan commented Nov 13, 2023

The stack indicates that a call f(g), where g itself has a generic function type, was instantiated, and the syntax of g was found not to be one of the following forms: id, pkg.F, F[T], pkg.F[T], F[T, T2], pkg.F[T, T2].

I wonder whether it's possible that g was an anonymous function (FuncLit)? A better panic message would help.

Paging go/types experts @findleyr, @gri.

@adonovan adonovan added TypeInference Issue is related to generic type inference NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 13, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.2, gopls/v0.15.0 Nov 14, 2023
@gopherbot
Copy link

Change https://go.dev/cl/545615 mentions this issue: go/types: include AST in instantiatedIdent panic message

gopherbot pushed a commit that referenced this issue Nov 28, 2023
Updates #63933

Change-Id: I3ff71e92d124c850eb8b4d136e163bf5786897a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/545615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
@adonovan
Copy link
Member

Let's reopen this as we're waiting for information from crash reports from the field, and that could take several weeks.

@adonovan adonovan reopened this Dec 11, 2023
@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
@adonovan adonovan removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 11, 2023
@adonovan adonovan reopened this Dec 11, 2023
@findleyr
Copy link
Contributor

Let's reopen this as we're waiting for information from crash reports from the field, and that could take several weeks.

We probably won't get more data on this until the v0.15.0-pre.1 prerelease. But yes, this is definitely a real bug (albeit rare) as we've seen this in a couple google internal reports as well. Still need more info to diagnose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. TypeInference Issue is related to generic type inference
Projects
None yet
Development

No branches or pull requests

7 participants