types(TY7): exact ..rest size bound + match_list split #34

Manually merged
dferreira merged 4 commits from feat/034-types-ty7-exact-rest-size-bound-match-list-spl into master 2026-02-10 14:03:41 +01:00
Owner

types(TY7): exact ..rest size bound + match_list split

Along the way:

  • types(TY6): record + actor-state field = default values
  • style: reformat load.rs + paths.rs under rustfmt 1.8.0
  • docs(TY): reconcile type-system status with implementation

Touches 31 files: docs/errors/E0308.md, docs/impl/08-diagnostics.md, docs/impl/slices.md, docs/impl/type-system/README.md, docs/impl/type-system/TY6-construction-and-projection.md, docs/impl/type-system/TY7-exhaustive-match-and-narrowing.md and 25 more.

types(TY7): exact ..rest size bound + match_list split Along the way: - types(TY6): record + actor-state field `= default` values - style: reformat load.rs + paths.rs under rustfmt 1.8.0 - docs(TY): reconcile type-system status with implementation Touches 31 files: `docs/errors/E0308.md`, `docs/impl/08-diagnostics.md`, `docs/impl/slices.md`, `docs/impl/type-system/README.md`, `docs/impl/type-system/TY6-construction-and-projection.md`, `docs/impl/type-system/TY7-exhaustive-match-and-narrowing.md` and 25 more.
Author
Owner

Split. The decision in synth_list_match is a pure function now, with its own tests in src/rust/crates/ck_types/src/match_list.rs.

Split. The decision in `synth_list_match` is a pure function now, with its own tests in `src/rust/crates/ck_types/src/match_list.rs`.
Author
Owner

It said what I assumed. Reworded in src/rust/crates/ck_resolve/src/field_defaults.rs so it names the input that broke it, which is what the bug report will need.

It said what I assumed. Reworded in `src/rust/crates/ck_resolve/src/field_defaults.rs` so it names the input that broke it, which is what the bug report will need.
dferreira approved these changes 2026-02-10 13:00:00 +01:00
dferreira left a comment

A clear improvement. The change in src/rust/crates/ck_types/src/match_list.rs is the part I would have argued for.

A clear improvement. The change in `src/rust/crates/ck_types/src/match_list.rs` is the part I would have argued for.
@ -0,0 +137,4 @@
&mut interner,
);
assert!(linked.diagnostics.is_empty(), "{:?}", linked.diagnostics);
let (_, scope) = linked.modules.iter().next().expect("one linked module");
Owner

The expect message on iter is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?

The expect message on `iter` is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?
@ -0,0 +29,4 @@
/// Type a list `match` and check its **structural** exhaustiveness (Maranget
/// over the two list constructors — empty and cons). Returns the union of the
/// arm bodies (synthesis-only), like the tag-set path.
pub(crate) fn synth_list_match(
Owner

synth_list_match reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?

`synth_list_match` reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?
Land the last unblocked TY7-internal sliver: a `..rest` capture now binds
the exact reduced size bound rather than the full scrutinee list type.
`[a, ..rest]` over `List<T, 8>` binds `rest: List<T, 7>` (the `Ty::Value`
size argument decremented by the fixed head count, saturating at 0); by
invariant generics that tail is now correctly rejected where the full
bound is wanted. Golden `match_list_rest_size_binder.cktest` proves it via
E0702 (`List<Cat, 7>` vs `List<Cat, 8>`), trapped; plus `list_rest_type`
unit tests.

Split the structural list-match path out of `match_check.rs` into a new
`match_list.rs` (a clean responsibility split: Maranget/list path vs
tag-set path) to hold the R3 per-file LoC cap; `process_pattern`, `Cover`,
and `ClosedTags` (+ `ClosedTags::none()`) become `pub(crate)`. The cap
stays pinned at 813 by `ck_resolve/src/bodies.rs`, so no gate is weakened.

Docs: TY7 slice doc -> nine slivers, deferred list rewritten so each
residual names its blocking slice (record-destructuring -> TY6,
`Panic::raise`->`Nothing` E0720 trigger -> TY8) or is out of locked scope;
README cascade row -> all TY7-internal slivers landed.

Gates: build + cargo test (incl. conformance + R3/R4 arch + untrapped
ratchet) + clippy --all-targets -D warnings all green.
Finish TY6's locked-but-deferred field-default slice end-to-end:
parser accepts `= Expr` on the shared field production; CST
`RecordField::value()` / `StateField::ty()`; N1 `FieldData.has_default`;
resolver lowers each default as a self-contained body into a new
span-keyed `ResolvedModule.field_defaults` side-channel; TY6
`check_field_defaults` synthesizes and asserts assignability.

Default mismatch -> E0702 (field-value boundary, not return-style
E0703); completeness reads `has_default` to fill, not report (no false
E0716). A `= default` on a trait field or data variant payload -> new
E0308. Architecture caps respected by extraction (bodies tests ->
bodies/tests.rs, CST accessors -> ast/members.rs, shared Walker::new);
MAX_FILE_LOC ratcheted 813->807.
Pre-existing fmt drift in the two files held back from earlier
refactor commits. Mechanical `cargo fmt` only; no ratchet change
(both files grew, R3 worst case unchanged at ast.rs:807).
The type-system README cascade table, the TY7 doc status line, and the
slices.md type-system cell lagged the code: TY4c/TY5/TY6/TY7 had all
landed (verified against E0701-E0721 + E0726-E0730 in ck_types) while the
docs still showed TY4 as 🟡, TY6 as ⬜, and TY7 as 🟧/🟢. Flipped all to
✅, retiring the ad-hoc symbols not in the status legend.

Correctness catch: record-destructuring (named-payload) match binders were
documented as "carried out → TY6", which read as done now that TY6 is ✅.
The code (payload.rs, match_check.rs) keeps them typed Unknown — the binder
typing is not yet landed and is owned by no slice. Stated explicitly in the
README TY7 row, the TY7 deferred note, and TY6's "Deferred to later slices".
dferreira manually merged commit 85d940716d into master 2026-02-10 14:03:41 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/cklang-bootstrap!34
No description provided.