@scriptc/compiler 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2574,7 +2574,15 @@ export function lowerUnionSwitch(L, stmt, disc) {
2574
2574
  !pureReemittable(test)) {
2575
2575
  L.unsupported("SC1090", clause.expression, "effectful case tests in a union-typed switch (bind the test value to a const first)");
2576
2576
  }
2577
- pendingTests.push({
2577
+ // A unit-literal test takes the unit-comparison lowering: a tag
2578
+ // test when the arm exists, the constant FALSE when the union
2579
+ // lacks it (`case null:` on a `number | undefined` — legal TS,
2580
+ // never matches; coercing the literal into the union would hit
2581
+ // the stranded-arm trap and throw where JS just skips the case).
2582
+ const unitTest = test.kind === "unitLit"
2583
+ ? L.lowerUnitComparison(disc, test, false, locOf(clause.expression))
2584
+ : null;
2585
+ pendingTests.push(unitTest ?? {
2578
2586
  kind: "unionEq",
2579
2587
  unionId: unionType.unionId,
2580
2588
  negated: false,