Skip to content

Typechecker cleanup: one helper for a record's fields at its type arguments; comments without audit-round tags - #148

Merged
rendro merged 2 commits into
mainfrom
w2/typecheck-cleanup
Oct 24, 2026
Merged

rendro merged 2 commits into
mainfrom
w2/typecheck-cleanup

Conversation

@rendro

@rendro rendro commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Lane E, PR 1 of 2 (wave 2). No visible change.

  • One helper for a record's fields at its type arguments. Four copies call instantiate_record_fields_with_args: in inference.rs, field access and record update; in solve.rs, the field constraint and the update constraint. On an arity mismatch, the solve.rs update path returned the template fields; it now takes fresh variables like the others. A unit test locks the helper: record_fields_at_a_wrong_number_of_arguments_take_fresh_variables.
  • Typechecker comments now say what holds, not which audit round found it. 73 round-NN lines and 9 other history tags are reworded. Comments only, plus one assert message.

Checks: whole suite, 2609/2609 passed; doc tests; clippy both ways; fmt; rustdoc -D warnings; no-default-features check.

The block that substitutes a declared record's parameter variables with
a use's type arguments, falling back to fresh variables on a wrong
number of arguments, was written out four times beside the helper that
does it (instantiate_record_fields_with_args): the field access in
infer_expr and in the deferred field constraint, and the record update
in infer_expr and in the deferred update. All four call the helper now.

The deferred update (solve.rs) had no fallback: on a wrong number of
arguments it returned the record's TEMPLATE fields, whose variables
every use of the record shares, so the update could decide them for
all. It takes fresh variables now, as the other three did.

Nothing changes for someone writing silt: a wrong number of type
arguments is reported where the type is written. A unit test locks the
helper's two cases.
The "round NN" tags (GAP (round 35 F6), Round 74 Fix #2, BROKEN
(round 93), LATENT (round 88), ...) and the other audit-history tags
(GAP-2, BROKEN #1, T1 audit fix, Pre-fix ...) leave src/typechecker:
73 lines with a round number and 9 more tags. Each comment keeps what
it explains, worded as what the code does now; a past behaviour stays
only where it is the reason for the code ("would ..."). Two comments
that cited a lock test that no longer exists (the round-83 STYLE
lock) drop the citation.

No code changes.
@rendro
rendro added this pull request to stack #154 October 24, 2026 05:11
@rendro
rendro marked this pull request as ready for review October 24, 2026 12:02
@rendro
rendro merged commit 61da15b into main Oct 24, 2026
23 checks passed
@rendro
rendro deleted the w2/typecheck-cleanup branch October 24, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant