ReviewOS

home-lang/home

Port direct IIFE tuple context and type-only import recovery

#774
Closed chris opened this 8 days ago ·
8 days ago

Home's checker lost contextual return information when an object literal was returned from a directly invoked function expression. Nested array members therefore widened to arrays before the outer Record<K, [A, B]> relation, producing false tuple-length errors. Complex cross-module projections could also recover an explicit named type-only import through value space and emit false TS2749 diagnostics.

Port the TypeScript behavior by:

  • propagating a direct IIFE call's result context into the function return context;
  • retaining compatible tuple targets for array members in direct-IIFE result objects while preserving length failures;
  • treating explicit named type-only imports as authoritative type-space declarations when cross-module projection recovers;
  • preserving TS1361 for actual runtime uses of type-only bindings.

Acceptance:

  • focused positive and negative regressions pass;
  • official TypeScript accepts the compatible tuple and rejects the short tuple;
  • full checker suite passes;
  • full JSC build passes;
  • pinned Zod 4.5.2 loses only the expected three diagnostics with no additions.
8 days ago

Completed in e32642e and pushed to origin/main. Validation: checker 4395/4395, full JSC build 50/50, pinned Zod 16 -> 13 with exactly three removals and zero additions.

Sign in to comment on this issue.