Closed
Description
git clone https://github.com/expo/expo --filter=blob:none
cd expo
No need to run yarn
. Then:
/path/to/typescript-go/built/local/tsgo.exe -p . --extendedDiagnostics
panic: runtime error: slice bounds out of range [1:0]
goroutine 11831 [running]:
github.com/microsoft/typescript-go/internal/core.(*Pattern).Matches(...)
D:/typescript-go/internal/core/pattern.go:28
github.com/microsoft/typescript-go/internal/core.FindBestPatternMatch[...]({0x4023f8b180?, 0xb, 0xc}, 0x7ff7ba1de310?, {0x4009e72cd0, 0xc})
D:/typescript-go/internal/core/pattern.go:46 +0x208
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveExternalModule(0x402c941008, 0x400d9a2a20, {0x4009e72cd0, 0xc}, 0x0, 0x400d9a2a20, 0x7?)
D:/typescript-go/internal/checker/checker.go:14299 +0x204
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveExternalModuleNameWorker(0x402c941008, 0x400d9a2a20, 0x400d9a2a20, 0x0, 0x0, 0x1)
D:/typescript-go/internal/checker/checker.go:14271 +0x80
github.com/microsoft/typescript-go/internal/checker.(*Checker).mergeModuleAugmentation(0x402c941008, 0x400d9a2a20)
D:/typescript-go/internal/checker/checker.go:1297 +0xc8
github.com/microsoft/typescript-go/internal/checker.(*Checker).initializeChecker(0x402c941008)
D:/typescript-go/internal/checker/checker.go:1273 +0x938
github.com/microsoft/typescript-go/internal/checker.NewChecker({0x7ff7ba2a2058, 0x4000140000})
D:/typescript-go/internal/checker/checker.go:1036 +0x6300
github.com/microsoft/typescript-go/internal/compiler.(*Program).createCheckers.func1.1()
D:/typescript-go/internal/compiler/program.go:233 +0x30
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
D:/typescript-go/internal/core/workgroup.go:39 +0x50
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 11679
D:/typescript-go/internal/core/workgroup.go:37 +0x7c
panic: runtime error: slice bounds out of range [1:0]
goroutine 11832 [running]:
github.com/microsoft/typescript-go/internal/core.(*Pattern).Matches(...)
D:/typescript-go/internal/core/pattern.go:28
github.com/microsoft/typescript-go/internal/core.FindBestPatternMatch[...]({0x4023915d60?, 0xb, 0xc}, 0x7ff7ba1de310?, {0x4009e72cd0, 0xc})
D:/typescript-go/internal/core/pattern.go:46 +0x208
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveExternalModule(0x402c2cb008, 0x400d9a2a20, {0x4009e72cd0, 0xc}, 0x0, 0x400d9a2a20, 0x7?)
D:/typescript-go/internal/checker/checker.go:14299 +0x204
github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveExternalModuleNameWorker(0x402c2cb008, 0x400d9a2a20, 0x400d9a2a20, 0x0, 0x0, 0x1)
D:/typescript-go/internal/checker/checker.go:14271 +0x80
github.com/microsoft/typescript-go/internal/checker.(*Checker).mergeModuleAugmentation(0x402c2cb008, 0x400d9a2a20)
D:/typescript-go/internal/checker/checker.go:1297 +0xc8
github.com/microsoft/typescript-go/internal/checker.(*Checker).initializeChecker(0x402c2cb008)
D:/typescript-go/internal/checker/checker.go:1273 +0x938
github.com/microsoft/typescript-go/internal/checker.NewChecker({0x7ff7ba2a2058, 0x4000140000})
D:/typescript-go/internal/checker/checker.go:1036 +0x6300
github.com/microsoft/typescript-go/internal/compiler.(*Program).createCheckers.func1.1()
D:/typescript-go/internal/compiler/program.go:233 +0x30
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
D:/typescript-go/internal/core/workgroup.go:39 +0x50
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 11679
D:/typescript-go/internal/core/workgroup.go:37 +0x7c
Activity
DanielRosenwasser commentedon May 16, 2025
I think something is going wrong where
declare global
s are being folded into pattern exports. If you comment out bothdeclare global
s inpackage/expo/src/ts-declarations/global.d.ts
packages/expo-router/src/ts-declarations/expo-router-internal-globals.ts
then you'll end up with a separate panic:
DanielRosenwasser commentedon May 16, 2025
Filed the second part at #871
DanielRosenwasser commentedon May 16, 2025
Can't repro but
len(candidate) >= p.StarIndex
check inMatches
is probably supposed to be a strict>
binder.go
, we probably should not actually track the pattern unless it's valid. Not sure why it was written this way.ahejlsberg commentedon May 16, 2025
Oddly, the crash doesn't happen if I run with
--noEmit
.