Open
Description
I'm running type-check in a large repo (31275 files) with npx tsgo --noEmit
command, and got the following error
panic: runtime error: slice bounds out of range [:-1]
goroutine 56505 [running]:
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).addPropertyToElementList(0x1405726a7e0, 0x141940271e8, {0x14194062a00, 0x5, 0x8})
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2163 +0x6dc
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).createTypeNodesFromResolvedType(0x1405726a7e0, 0x1419403e1a0)
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2234 +0x5a0
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).createTypeNodeFromObjectType(0x1405726a7e0, 0x1419403e1a0)
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2295 +0x22c
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).createAnonymousTypeNode(0x1405726a7e0?, 0x1419403e1a0?)
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2386 +0x310
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeToTypeNode(0x1405726a7e0, 0x1006330f8?)
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2928 +0x63c
github.com/microsoft/typescript-go/internal/core.Map[...](...)
github.com/microsoft/typescript-go/internal/core/core.go:56
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).mapToTypeNodes(0x1405726a7e0, {0x14194036a30, 0x2, 0x100773303?})
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:219 +0xc8
github.com/microsoft/typescript-go/internal/checker.(*nodeBuilderImpl).typeToTypeNode(0x1405726a7e0, 0x0?)
github.com/microsoft/typescript-go/internal/checker/nodebuilderimpl.go:2910 +0x6bc
github.com/microsoft/typescript-go/internal/checker.(*NodeBuilder).TypeToTypeNode(0x141440dbb90, 0x1419401ca50, 0x0?, 0xade2b0?, 0x1?, {0x0?, 0x0?})
github.com/microsoft/typescript-go/internal/checker/nodebuilder.go:163 +0x50
github.com/microsoft/typescript-go/internal/checker.(*Checker).typeToStringEx(0x141440cb008, 0x1419401ca50, 0x0, 0x104000)
github.com/microsoft/typescript-go/internal/checker/printer.go:185 +0x108
github.com/microsoft/typescript-go/internal/checker.(*Checker).TypeToString(...)
github.com/microsoft/typescript-go/internal/checker/printer.go:167
github.com/microsoft/typescript-go/internal/checker.(*Checker).getTypeNamesForErrorDisplay(0x141440cb008, 0x140521cf400, 0x1419401ca50)
github.com/microsoft/typescript-go/internal/checker/relater.go:1278 +0xbc
github.com/microsoft/typescript-go/internal/checker.(*Relater).reportRelationError(0x14145609200, 0x0, 0x140521cf400, 0x1419401ca50)
github.com/microsoft/typescript-go/internal/checker/relater.go:4663 +0x40
github.com/microsoft/typescript-go/internal/checker.(*Relater).reportErrorResults(0x14145609200, 0x140521cf400, 0x1419401ca50, 0x140521cf400, 0x1419401ca50, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:4651 +0x2a0
github.com/microsoft/typescript-go/internal/checker.(*Relater).isRelatedToEx(0x14145609200, 0x140521cf400, 0x1419401ca50, 0x3, 0x1, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:2660 +0x944
github.com/microsoft/typescript-go/internal/checker.(*Relater).typeArgumentsRelatedTo(0x14145609200, {0x14098b55db0, 0x1416f29e6f8?, 0x1005be938?}, {0x141940379c0, 0x0?, 0x1570a1c88?}, {0x140818f8050, 0x2, 0x1005bedb4?}, ...)
github.com/microsoft/typescript-go/internal/checker/relater.go:3882 +0x1a4
github.com/microsoft/typescript-go/internal/checker.(*Relater).structuredTypeRelatedToWorker.func1({0x14098b55db0?, 0x1419404ca80?, 0x1419404ca80?}, {0x141940379c0, 0x2, 0x1419405e5e0?}, {0x140818f8050, 0x2, 0x1416f29e808?}, 0x5a48a8?)
github.com/microsoft/typescript-go/internal/checker/relater.go:3210 +0xa8
github.com/microsoft/typescript-go/internal/checker.(*Relater).structuredTypeRelatedToWorker(0x14145609200, 0x141462b7b20, 0x1419404ca80, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:3770 +0x2268
github.com/microsoft/typescript-go/internal/checker.(*Relater).structuredTypeRelatedTo(0x14145609200, 0x141462b7b20, 0x1419404ca80, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:3137 +0x58
github.com/microsoft/typescript-go/internal/checker.(*Relater).recursiveTypeRelatedTo(0x14145609200, 0x141462b7b20, 0x1419404ca80, 0x1, 0x0, 0x2)
github.com/microsoft/typescript-go/internal/checker/relater.go:3078 +0x664
github.com/microsoft/typescript-go/internal/checker.(*Relater).isRelatedToEx(0x14145609200, 0x141462b7b20, 0x1419401b5e0, 0x2, 0x1, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:2653 +0x908
github.com/microsoft/typescript-go/internal/checker.(*Relater).typeRelatedToSomeType(0x14145609200, 0x141462b7b20, 0x14194052240, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:2975 +0x2f0
github.com/microsoft/typescript-go/internal/checker.(*Relater).unionOrIntersectionRelatedTo(0x14145609200, 0x141462b7b20, 0x14194052240, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:2827 +0x260
github.com/microsoft/typescript-go/internal/checker.(*Relater).structuredTypeRelatedToWorker(0x14145609200, 0x141462b7b20, 0x14194052240, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:3300 +0x534
github.com/microsoft/typescript-go/internal/checker.(*Relater).structuredTypeRelatedTo(0x14145609200, 0x141462b7b20, 0x14194052240, 0x1, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:3137 +0x58
github.com/microsoft/typescript-go/internal/checker.(*Relater).recursiveTypeRelatedTo(0x14145609200, 0x141462b7b20, 0x14194052240, 0x1, 0x0, 0x3)
github.com/microsoft/typescript-go/internal/checker/relater.go:3078 +0x664
github.com/microsoft/typescript-go/internal/checker.(*Relater).isRelatedToEx(0x14145609200, 0x141462b7b20, 0x14194052240, 0x3, 0x1, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/relater.go:2653 +0x908
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkTypeRelatedToEx(0x141440cb008, 0x141462b7b20, 0x14194052240, 0x1413a6b3898, 0x1402b081250, 0x0, 0x1416f29f5c0)
github.com/microsoft/typescript-go/internal/checker/relater.go:372 +0x138
github.com/microsoft/typescript-go/internal/checker.(*Checker).elaborateElement(0x141440cb008, 0x1419402d680, 0x1419402f7a0, 0x1413a6b3898, 0x1402b081250, 0x1402ad6cc00, 0x14114e3d380, 0x0, 0x14193e2da70)
github.com/microsoft/typescript-go/internal/checker/relater.go:570 +0x32c
github.com/microsoft/typescript-go/internal/checker.(*Checker).elaborateJsxComponents(0x141440cb008, 0x1402ad7dc20, 0x1419402d680, 0x1419402f7a0, 0x1413a6b3898, 0x14193e2da70)
github.com/microsoft/typescript-go/internal/checker/jsx.go:299 +0x190
github.com/microsoft/typescript-go/internal/checker.(*Checker).elaborateError(0x141440cb008, 0x1402ad7dc20, 0x1419402d680, 0x1419402f7a0, 0x1413a6b3898, 0x0, 0x14193e2da70)
github.com/microsoft/typescript-go/internal/checker/relater.go:466 +0x26c
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkTypeRelatedToAndOptionallyElaborate(0x141440cb008, 0x1419402d680, 0x1419402f7a0, 0x1413a6b3898, 0x1402b081178, 0x1402ad7dc20, 0x0, 0x14193e2da70)
github.com/microsoft/typescript-go/internal/checker/relater.go:432 +0x68
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkApplicableSignatureForJsxCallLikeElement(0x141440cb008, 0x1402ad7dc70, 0x300000002?, 0x1413a6b3898, 0x0, 0x1, 0x14193e2da70)
github.com/microsoft/typescript-go/internal/checker/jsx.go:683 +0x174
github.com/microsoft/typescript-go/internal/checker.(*Checker).isSignatureApplicable(0x14193b7c448?, 0x1?, {0x14193b7c448?, 0x100000000?, 0x14193e6fcf0?}, 0x2?, 0x2?, 0x0?, 0x0?, 0x14193e02360?, ...)
github.com/microsoft/typescript-go/internal/checker/checker.go:8925 +0x268
github.com/microsoft/typescript-go/internal/checker.(*Checker).reportCallResolutionErrors(0x141440cb008, 0x100ad3b80?, 0x1416f29fb10, {0x14193b7e8c0?, 0x2?, 0x14193b7c448?}, 0x0)
github.com/microsoft/typescript-go/internal/checker/checker.go:9324 +0xa0
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveCall(0x141440cb008, 0x1402ad7dc70, {0x14193b7e8c0, 0x2, 0x2}, 0x0, 0x0, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/checker.go:8594 +0x4c4
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveJsxOpeningLikeElement(0x141440cb008, 0x1402ad7dc70, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/jsx.go:567 +0x2dc
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveSignature(0x141440cb528?, 0x100ad3b80?, 0x1402ad7dc70?, 0x7734fb?)
github.com/microsoft/typescript-go/internal/checker/checker.go:8123 +0xd0
github.com/microsoft/typescript-go/internal/checker.(*Checker).getResolvedSignature(0x141440cb008, 0x1402ad7dc70, 0x0, 0x0)
github.com/microsoft/typescript-go/internal/checker/checker.go:8087 +0xd4
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkJsxOpeningLikeElementOrOpeningFragment(0x141440cb008, 0x1402ad7dc70)
github.com/microsoft/typescript-go/internal/checker/jsx.go:135 +0x7c
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkJsxSelfClosingElementDeferred(...)
github.com/microsoft/typescript-go/internal/checker/jsx.go:105
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkDeferredNode(0x141440cb008, 0x100ad2f00?)
github.com/microsoft/typescript-go/internal/checker/checker.go:2324 +0x1e4
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkDeferredNodes-range1(...)
github.com/microsoft/typescript-go/internal/checker/checker.go:2301
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkDeferredNodes.(*OrderedSet[...]).Keys.func1(...)
github.com/microsoft/typescript-go/internal/collections/ordered_map.go:129
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkDeferredNodes(0x141440cb008, 0x1402ad477b0?)
github.com/microsoft/typescript-go/internal/checker/checker.go:2297 +0xc0
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceFile(0x141440cb008, {0x100acd3e8, 0x100fdf520}, 0x1402ad37088)
github.com/microsoft/typescript-go/internal/checker/checker.go:2104 +0x108
github.com/microsoft/typescript-go/internal/checker.(*Checker).CheckSourceFile(0x141440cb008, {0x100acd3e8, 0x100fdf520}, 0x1402ad37088)
github.com/microsoft/typescript-go/internal/checker/checker.go:2092 +0x58
github.com/microsoft/typescript-go/internal/compiler.(*Program).CheckSourceFiles.func1-range1(0x141255aff38?)
github.com/microsoft/typescript-go/internal/compiler/program.go:335 +0x4c
github.com/microsoft/typescript-go/internal/compiler.(*checkerPool).Files.func1(0x141450bbf50)
github.com/microsoft/typescript-go/internal/compiler/checkerpool.go:82 +0x84
github.com/microsoft/typescript-go/internal/compiler.(*Program).CheckSourceFiles.func1()
github.com/microsoft/typescript-go/internal/compiler/program.go:334 +0xdc
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
github.com/microsoft/typescript-go/internal/core/workgroup.go:39 +0x5c
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 1
github.com/microsoft/typescript-go/internal/core/workgroup.go:37 +0x84