ReviewOS

home-lang/home

fix(ts): align contextual overload callback diagnostic chains with TypeScript

#959
Closed glennmichael123 opened this 6 days ago ·
6 days ago

Related #846. The checked-in TypeScript 5.7.3 differential fixture (commit 47fb80406) reproduces a contextual overload callback diagnostic without muting or replacing errors.

Both CLIs exit 2, write empty stderr, and report top-level TS2769, TS18048, and TS2339 in the same order. The current Home CLI does include the nested number-to-string reason in the second overload child; the earlier issue description claiming that reason was absent is outdated. Three exact mismatches remain:

  • TypeScript anchors TS2769 at main.ts(9,1); Home anchors it at (9,6) (the array argument).
  • TypeScript prints optional tuple elements as [(number | undefined)?] and [(string | undefined)?]; Home prints [number | undefined] and [string | undefined].
  • TypeScript's first child keeps the literal argument type "text"; Home widens it to string.

The checker regression overload applicability preserves final contextual callback diagnostics already expects two rejected overloads, but its position assertion currently expects the inner array argument, not TypeScript's call start. Source review: reportNoOverloadMatchesWithOverloads selects arg_error.node for its head; the signature display and tuple display paths omit the optional tuple marker. The literal widening still needs a source-level diagnosis. Preserve overload applicability, callback-body diagnostics, JSX-specific anchors, and the nested reason while correcting all three streams. Run the full checker and exact CLI stream suites under the agreed memory guard before closing; this oracle is deliberately not a passing Home parity claim.

6 days ago

Follow-up on main: bae3506 corrects the stale unit oracle to the two rejected candidates produced by pinned TypeScript 5.7.3. It also asserts that the first failure is the literal tag and the second is the tuple value, while retaining the contextual callback checks. The focused test and guarded full ts_checker run now exit successfully; peak measured tree footprint for the full run was 2,286 MB under the 3,840 MB cap.

This issue stays OPEN: candidate signature formatting, literal-vs-widened argument display, and the nested assignability reason still differ from the exact TypeScript 5.7.3 CLI output.

5 days ago

2026-10-29 verified fix: 71aa1fef0 is on origin/main under glennmichael123 without coauthors. It mirrors TypeScript 5.7.3's small-overload diagnostic rule: retain the candidate error span only when all candidates agree; otherwise anchor TS2769 at the call. It also renders optional tuple elements and retains literal argument identity until the target-aware formatter decides whether to widen. The original contextual callback oracle and a new differing-direct-arguments control are pinned as exact CLI streams, alongside the existing #846 imported-JavaScript overload controls. Guarded zig build test-tsc-streams -j1 exited 0 (peak tree footprint 2,329 MB; host low-water 29%). The checker wrapper exited 0 but printed a contradictory failed-command line, so I ran its built executable directly under a 2,048 MB guard: 4,713/4,713 tests passed, exit 0 (peak 996 MB; low-water 28%). The independent #846 99-config auditor was not rerun because its installed-binary freshness gate requires a separate build and host memory fell afterward. That broader #846 scope remains open; the #959 exact diagnostic acceptance is met.

Sign in to comment on this issue.