Skip to content

HandleNoEmitOnError/GetDiagnosticsOfAnyProgram cause concurrent checker use #2061

@Raynos

Description

@Raynos

Stack trace

[04:15:48 PM] Project 'workspaces/analytics/tsconfig.json' is up to date because newest input 'workspaces/analytics/src/util/runMainWithContext.ts' is older than output 'workspaces/analytics/dist/tsconfig.tsbuildinfo'

panic: runtime error: index out of range [-1]

goroutine 22672 [running]:
github.com/microsoft/typescript-go/internal/checker.(*Checker).popTypeResolution(...)
        github.com/microsoft/typescript-go/internal/checker/checker.go:18084
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveAlias(0x1400bd65308, 0x1401cd3a318)
        github.com/microsoft/typescript-go/internal/checker/checker.go:15685 +0x230
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkAliasSymbol(0x1400bd65308, 0x140079bb470)
        github.com/microsoft/typescript-go/internal/checker/checker.go:6435 +0x3c
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkImportBinding(0x1400bd65308, 0x140079bb470)
        github.com/microsoft/typescript-go/internal/checker/checker.go:5137 +0x48
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkImportDeclaration(0x1400bd65308, 0x140076533e0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:5071 +0x600
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElementWorker(0x1400bd65308, 0x140076533e0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2291 +0x348
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElement(0x1400bd65308, 0x1401de95dd0?)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2163 +0x4c
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElements(0x1400bd65308, {0x14007cea6f8, 0xd, 0x14007d5cf50?})
        github.com/microsoft/typescript-go/internal/checker/checker.go:2154 +0x34
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceFile(0x1400bd65308, {0x1057631f0, 0x105d87620}, 0x1400765f808)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2127 +0xf4
github.com/microsoft/typescript-go/internal/checker.(*Checker).CheckSourceFile(0x1400bd65308, {0x1057631f0, 0x105d87620}, 0x1400765f808)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2116 +0x64
github.com/microsoft/typescript-go/internal/checker.(*Checker).getDiagnostics(0x1400bd65308, {0x1057631f0, 0x105d87620}, 0x1400765f808, 0x1400bd654f0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:13438 +0xac
github.com/microsoft/typescript-go/internal/checker.(*Checker).GetDiagnostics(...)
        github.com/microsoft/typescript-go/internal/checker/checker.go:13421
github.com/microsoft/typescript-go/internal/compiler.(*Program).getSemanticDiagnosticsForFileNotFilter(0x14000383c00, {0x1057631f0, 0x105d87620}, 0x1400765f808)
        github.com/microsoft/typescript-go/internal/compiler/program.go:1037 +0x27c
github.com/microsoft/typescript-go/internal/compiler.(*Program).getSemanticDiagnosticsForFile(0x14000383c00, {0x1057631f0?, 0x105d87620?}, 0x1400765f808)
        github.com/microsoft/typescript-go/internal/compiler/program.go:1012 +0x30
github.com/microsoft/typescript-go/internal/compiler.(*Program).getDiagnosticsHelper(0x0?, {0x1057631f0, 0x105d87620}, 0x1400765f808?, 0x0?, 0x0?, 0x14000eeac28)
        github.com/microsoft/typescript-go/internal/compiler/program.go:1209 +0xf4
github.com/microsoft/typescript-go/internal/compiler.(*Program).GetSemanticDiagnostics(0x0?, {0x1057631f0?, 0x105d87620?}, 0x105759130?)
        github.com/microsoft/typescript-go/internal/compiler/program.go:416 +0x3c
github.com/microsoft/typescript-go/internal/compiler.GetDiagnosticsOfAnyProgram({0x1057631f0, 0x105d87620}, {0x1057692c0, 0x14000383c00}, 0x1400765f808, 0x1, 0x14000eead60, 0x14000eead48)
        github.com/microsoft/typescript-go/internal/compiler/program.go:1500 +0x364
github.com/microsoft/typescript-go/internal/compiler.HandleNoEmitOnError({0x1057631f0, 0x105d87620}, {0x1057692c0, 0x14000383c00}, 0x1400765f808)
        github.com/microsoft/typescript-go/internal/compiler/program.go:1457 +0x98
github.com/microsoft/typescript-go/internal/compiler.(*Program).Emit(0x14000383c00, {0x1057631f0, 0x105d87620}, {0x1400765f808?, 0xc0?, 0x14023f20270?})
        github.com/microsoft/typescript-go/internal/compiler/program.go:1364 +0x74
github.com/microsoft/typescript-go/internal/execute/incremental.(*emitFilesHandler).emitFilesIncremental.func1.1()
        github.com/microsoft/typescript-go/internal/execute/incremental/emitfileshandler.go:124 +0x12c
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
        github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x24
sync.(*WaitGroup).Go.func1()
        sync/waitgroup.go:239 +0x4c
created by sync.(*WaitGroup).Go in goroutine 292
        sync/waitgroup.go:237 +0x70

Steps to reproduce

  1. I would not be able to tell you, it's one of the pnpm workspaces in the monorepo that gives up with a panic.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions