-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone 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.release-blocker
Milestone
Description
gopls version: (devel) (go1.21.0) (built from 47c5305)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.21.0
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Thu, 10 Aug 2023 15:53:47 GMT
restart history:
Thu, 10 Aug 2023 15:33:15 GMT: activation (enabled: true)
Thu, 10 Aug 2023 15:52:58 GMT: manual (enabled: true)
Thu, 10 Aug 2023 15:53:29 GMT: manual (enabled: true)
panic: runtime error: index out of range [2] with length 2 [recovered]
panic: runtime error: index out of range [2] with length 2
goroutine 227 [running]:
go/types.(*Checker).handleBailout(0xc0002c05a0, 0xc0004a7578)
/home/joe/sdk/go1.21.0/src/go/types/check.go:336 +0x88
panic({0xe748e0?, 0xc00003c7e0?})
/home/joe/sdk/go1.21.0/src/runtime/panic.go:914 +0x21f
go/types.(*Checker).arguments(0xc0002c05a0, 0xc0000fc300, 0xc000381a80, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc0008204f8, ...}, ...)
/home/joe/sdk/go1.21.0/src/go/types/call.go:648 +0x17a5
go/types.(*Checker).callExpr(0xc0002c05a0, 0xc000381800, 0xc0000fc300)
/home/joe/sdk/go1.21.0/src/go/types/call.go:302 +0x86d
go/types.(*Checker).exprInternal(0xc0002c05a0, {0x0, 0x0}, 0xc000381800, {0x116bf60, 0xc0000fc300?}, {0x0?, 0x0?})
/home/joe/sdk/go1.21.0/src/go/types/expr.go:1359 +0x1809
go/types.(*Checker).rawExpr(0xc0002c05a0, {0x0, 0x0}, 0xc000381800, {0x116bf60?, 0xc0000fc300?}, {0x0?, 0x0?}, 0x0)
/home/joe/sdk/go1.21.0/src/go/types/expr.go:965 +0x1a5
go/types.(*Checker).stmt(0xc0002c05a0, 0x0, {0x116c3b0?, 0xc000692070?})
/home/joe/sdk/go1.21.0/src/go/types/stmt.go:397 +0x19a
go/types.(*Checker).stmtList(0xc0002c05a0?, 0x0, {0xc000692080?, 0x0?, 0x6d4cfb?})
/home/joe/sdk/go1.21.0/src/go/types/stmt.go:124 +0x85
go/types.(*Checker).funcBody(0xc0002c05a0, 0xc00052c720, {0xc00061e014?, 0xc000116b90?}, 0xc000381540, 0xc000620180, {0x0, 0x0})
/home/joe/sdk/go1.21.0/src/go/types/stmt.go:44 +0x345
go/types.(*Checker).funcDecl.func1()
/home/joe/sdk/go1.21.0/src/go/types/decl.go:826 +0x39
go/types.(*Checker).processDelayed(0xc0002c05a0, 0x0)
/home/joe/sdk/go1.21.0/src/go/types/check.go:439 +0x15c
go/types.(*Checker).checkFiles(0xc0002c05a0, {0xc0000b6418, 0x1, 0x1})
/home/joe/sdk/go1.21.0/src/go/types/check.go:383 +0x245
go/types.(*Checker).Files(...)
/home/joe/sdk/go1.21.0/src/go/types/check.go:341
golang.org/x/tools/gopls/internal/lsp/cache.doTypeCheck({0x116d688, 0xc00058ef30}, 0xc00052c240, {{0xc0008826f6, 0xa}, {0xc0008826f6, 0xa}, {0xc000882710, 0x4}, {0xc0001a21f0, ...}, ...})
/home/joe/tools/gopls/internal/lsp/cache/check.go:1561 +0x8a5
golang.org/x/tools/gopls/internal/lsp/cache.typeCheckImpl({0x116d688, 0xc00058edb0}, 0x2?, {{0xc0008826f6, 0xa}, {0xc0008826f6, 0xa}, {0xc000882710, 0x4}, {0xc0001a21f0, ...}, ...})
/home/joe/tools/gopls/internal/lsp/cache/check.go:1420 +0x205
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackage(0xc0000c3ed8?, {0x116d688, 0xc00058e480}, 0xc000592240)
/home/joe/tools/gopls/internal/lsp/cache/check.go:674 +0x245
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).handleSyntaxPackage(0xc00052c240, {0x116d688, 0xc00058e480}, 0xc0006c5860?, {0xc0008826f6, 0xa})
/home/joe/tools/gopls/internal/lsp/cache/check.go:532 +0x42a
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).forEachPackageInternal.func2()
/home/joe/tools/gopls/internal/lsp/cache/check.go:394 +0x2b
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/joe/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 158
/home/joe/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96
Here is a minimal program that can reproduce the bug. Deleting the last ')' on line 8 will cause gopls to crash.
package main
func A[T any](func(T) T, ...any) {}
func B[T any](t T) T { return t }
func C(args ...func(any)) any { return nil }
func main() {
A[any](B, C(func(any) {})) // Delete the last ) on this line
}
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone 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.release-blocker