Keep the branded-primitive rule compilable by the self-hosted frontend

Once shadow mode imports the normalizer, the self-hosted frontend lowers
it, and it cannot compare union-typed canonical nodes by identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Malte Ubl
2026-10-26 05:49:39 -07:00
co-authored by Claude Opus 5.5
parent 5c14941617
commit f03741b03e
+2 -1
View File
@@ -392,7 +392,8 @@ export class Normalizer {
return arms.length === 1 ? arms[0]! : { k: "union", arms };
}
const prims = parts.filter((p) => p.k === "prim" || p.k === "lit");
if (prims.length === 1 && parts.every((p) => p === prims[0] || p.k === "obj")) return prims[0]!;
if (prims.length === 1 && parts.every((p) => p.k === "prim" || p.k === "lit" || p.k === "obj"))
return prims[0]!;
if (parts.every((p) => p.k === "obj" || (p.k === "top" && p.t === "object")))
return this.object(type, env, key);
return { k: "opaque", ts: type, reason: "intersection" };