Repository navigation
Crash: Unhandled case in resolveStructuredTypeMembers when switching on an evolving [] array inside a loop #64813
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: check: Control FlowThe issue relates to control flow analysisThe issue relates to control flow analysis
Milestone
Description
🔎 Search Terms
"Unhandled case in resolveStructuredTypeMembers"
🕗 Version & Regression Information
Commit:
9eedcb0dd7257f8a1a175adbef28f3b6d3492d7a (main, 2026-10-14); also aa8149273b23401f0a79a5f0384c42de51888693
Build configuration:
cd tsc && go build -o tsc ./cmd/tsc (GOWORK=off, GOTOOLCHAIN=auto -> go1.27.0)
Operating System:
Ubuntu 24.04.4 LTS (Docker image fusion-fuzz-typescript:latest), linux/amd64
⏯ Playground Link
No response
💻 Code
const a = [];
while (true) switch (a) { case 0: }🙁 Actual behavior
panic: Unhandled case in resolveStructuredTypeMembers [recovered, repanicked]
goroutine 313 [running]:
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).resolveStructuredTypeMembers(...)
tsc/internal/checker/checker.go:19531
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).isWeakType(...)
tsc/internal/checker/relater.go:681
github.com/microsoft/TypeScript/tsc/internal/checker.(*Relater).isRelatedToEx(...)
tsc/internal/checker/relater.go:2711
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).checkTypeRelatedToEx(...)
tsc/internal/checker/relater.go:370
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).isTypeRelatedTo(...)
tsc/internal/checker/relater.go:200
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).areTypesComparable(...)
tsc/internal/checker/relater.go:166
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).narrowTypeBySwitchOnDiscriminant.func1(...)
tsc/internal/checker/flow.go:1132
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).filterType(...)
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).narrowTypeBySwitchOnDiscriminant(...)
tsc/internal/checker/flow.go:1132
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeAtSwitchClause(...)
tsc/internal/checker/flow.go:1066
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeAtFlowNode(...)
tsc/internal/checker/flow.go:161
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getTypeAtFlowLoopLabel(...)
tsc/internal/checker/flow.go:1370
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).getFlowTypeOfReferenceEx(...)
tsc/internal/checker/flow.go:98
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).checkIdentifier(...)
github.com/microsoft/TypeScript/tsc/internal/checker.(*Checker).checkSwitchStatement(...)
🙂 Expected behavior
no crash
Additional information about the issue
To reproduce: tsc ./min.ts
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: check: Control FlowThe issue relates to control flow analysisThe issue relates to control flow analysis
Activity