From 90d024cd8c5affe3a3b75efe2caca197591cbcca Mon Sep 17 00:00:00 2001 From: Malte Ubl Date: Thu, 8 Oct 2026 11:27:37 -0700 Subject: [PATCH] Keep inline RC helper enumeration inside the self-hosted subset The bootstrap-seed build rejected `host.rcHelpers ?? []` in shapes.ts (SC2011: `Set | never[]` has no static representation) and the spread of that union into a string[] literal (SC1090). A small helper copies the set's keys into a plain array (empty when inline RC is off), which both callers iterate; emitInlineRcHelpers still sorts its copy. Behavior is unchanged. --- packages/compiler/src/backend/llvm/shapes.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/compiler/src/backend/llvm/shapes.ts b/packages/compiler/src/backend/llvm/shapes.ts index bd6d1a76d..ad9dff18b 100644 --- a/packages/compiler/src/backend/llvm/shapes.ts +++ b/packages/compiler/src/backend/llvm/shapes.ts @@ -244,9 +244,18 @@ function rcHelperDecls(family: string, op: RcOp): string[] { } /** The runtime declarations the requested helpers call (deduplicated). */ +/** The inline retain/release helper keys ("family:op") the program used, in + * insertion order; empty when inline RC is off. Copied into a plain array so + * callers stay inside the self-hosted subset (no `Set | []` unions). */ +function rcHelperKeys(host: ShapeHost): string[] { + const keys: string[] = []; + if (host.rcHelpers) for (const key of host.rcHelpers) keys.push(key); + return keys; +} + export function inlineRcDecls(host: ShapeHost): string[] { const decls = new Set(); - for (const key of host.rcHelpers ?? []) { + for (const key of rcHelperKeys(host)) { const [family, op] = key.split(":") as [string, RcOp]; for (const decl of rcHelperDecls(family, op)) decls.add(decl); } @@ -383,7 +392,7 @@ function releaseHelper(host: ShapeHost, family: string, row: InlineRcFamily): st * the trace-slot offsets. */ export function emitInlineRcHelpers(host: ShapeHost): string[] { const out: string[] = []; - for (const key of [...(host.rcHelpers ?? [])].sort()) { + for (const key of rcHelperKeys(host).sort()) { const [family, op] = key.split(":") as [string, RcOp]; const row = INLINE_RC_FAMILIES[family]!; out.push(