chore(lints): temporarily disable dead_code for the slices 1–8 root pass #62

Manually merged
mdoorn merged 6 commits from feat/062-chore-lints-temporarily-disable-dead-code-for into master 2026-03-18 10:27:11 +01:00
Owner

chore(lints): temporarily disable dead_code for the slices 1–8 root pass

Along the way:

  • feat(parser): the four Floor.ck grammar forms (slice 1/2 — additive surface)
  • wip(root): LeafRepr foundation — the one generic scalar law (inert)
  • fix(arch): repair R3/R4 LOC ratchets from the LeafRepr foundation
  • feat(lang): Stage G — the Tuple grammar and the general = expr fn body
  • feat(floor): Stage A1 — Floor.ck live; intrinsics keyed off the body opcode

Touches 50 files: docs/impl/03-parser.md, src/rust/Cargo.toml, src/rust/crates/ck_codegen/src/call.rs, src/rust/crates/ck_codegen/src/format.rs, src/rust/crates/ck_codegen/src/lib.rs, src/rust/crates/ck_codegen/src/resolution.rs and 44 more.

chore(lints): temporarily disable dead_code for the slices 1–8 root pass Along the way: - feat(parser): the four Floor.ck grammar forms (slice 1/2 — additive surface) - wip(root): LeafRepr foundation — the one generic scalar law (inert) - fix(arch): repair R3/R4 LOC ratchets from the LeafRepr foundation - feat(lang): Stage G — the `Tuple` grammar and the general `= expr` fn body - feat(floor): Stage A1 — Floor.ck live; intrinsics keyed off the body opcode Touches 50 files: `docs/impl/03-parser.md`, `src/rust/Cargo.toml`, `src/rust/crates/ck_codegen/src/call.rs`, `src/rust/crates/ck_codegen/src/format.rs`, `src/rust/crates/ck_codegen/src/lib.rs`, `src/rust/crates/ck_codegen/src/resolution.rs` and 44 more.
mdoorn approved these changes 2026-03-18 08:51:30 +01:00
mdoorn left a comment

Happy with this. I ran the suite against the branch and it is green, src/rust/crates/ck_syntax/src/type_decls.rs included.

Happy with this. I ran the suite against the branch and it is green, `src/rust/crates/ck_syntax/src/type_decls.rs` included.
@ -173,0 +286,4 @@
}
/// The value token text (`IntLit` / `TrueKw` / `FalseKw`) of a `LeafAttr`.
fn leaf_attr_value_token<'a>(attr: &SyntaxNode, src: &'a str) -> Option<&'a str> {
Owner

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

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

Split. The decision in leaf_attr_value_token is a pure function now, with its own tests in src/rust/crates/ck_syntax/src/type_decls.rs.

Split. The decision in `leaf_attr_value_token` is a pure function now, with its own tests in `src/rust/crates/ck_syntax/src/type_decls.rs`.
Owner decision 2026-07-11: dead_code = "deny" is the strict-subtraction
forcing gate, but the merged slices 1–3 (intrinsics + primitives + alloc)
root pass leaves building-but-unwired code across several commits (e.g. the
new format-driven emitter beside the old fn-name arms). Commenting it out
unblocks incremental commits; it is re-enabled and the tree swept after
slice 8. unsafe_code = "forbid" and the clippy deny lints stay live.
The authored Floor.ck / Alloc.ck cannot resolve until the parser reads the
four surface forms the root pass introduces. This is purely additive parser +
CST-accessor work; no existing production changes, all 485 parser tests plus
the corpus stay green (Floor.ck is not yet injected).

  1a. Attr-block newtype — `newtype i8 { size: 8, signed: true, float: false }`.
      A scalar leaf's machine-attribute block (metadata, like an operator's
      config block; NOT a field record — a leaf is opaque, no `.value`). New
      LeafAttrs/LeafAttr node kinds; NewtypeDecl accessors read size/signed/
      float and the attr-name set (for the closed-leaf-set arch-test).
  1b. Alias newtype — `newtype Handle = usize`. NewtypeDecl::alias_target.
  1c. Enumerated `where` — `where T is A or B or C` folds the bound into a
      UnionType via parse_type_expr; `and` joins predicates
      (`where From is … and To is …`).
  1d. Opcode-in-body — `= intrinsic.<opcode>(args)`: a `.`-member on the
      `intrinsic` keyword capturing the opcode ident (emitted verbatim, no
      name→opcode table) plus an arg list. FnDecl::intrinsic_opcode_span /
      intrinsic_arg_list accessors.

New diagnostics E0124–E0129 (opcode/arg-list/leaf-attr malformations).
Additive, inert foundation for the root-live slice's Ty::Primitive collapse:
a well-known-scalar-name -> TypeId registry + a TypeId -> {size,signed,float}
LeafRepr map on the interner (ck_hir), plus the resolve hook that registers a
leaf newtype from Floor.ck's {size,signed,float} attr block. Inert until
Floor.ck is injected (no leaf newtypes exist yet); build green, tests
unaffected. Checkpoint on wip_v2 so the collapse builds directly onto it.

Part of the root-live slice (slices 1-3 merged); dead_code=deny temporarily
off (owner 2026-07-11), re-enabled + swept after slice 8.
The LeafRepr foundation (8415d62) pushed ck_hir/src/lib.rs to 849 lines
(R3 cap 815) and alloc_item to 90 lines (R4 cap 80), leaving both
ratchets red. Split the scalar-leaf machine repr + well-known-scalar
registry methods into ck_hir/src/leaf.rs (mirrors fields.rs), and
extract the newtype/leaf-registration arm of alloc_item into a dedicated
alloc_newtype helper. No behavior change; both ratchets green.
Two settled grammar forms the authored design files (`Types.ck`, `Alloc.ck`)
need, landed end-to-end (lex → parse → CST → resolve → type → lowering-boundary)
as additive surface — no leaf deleted, `Ty::Primitive` / the intrinsic registry
/ `binop_lower` untouched, `Floor.ck` / `Alloc.ck` not injected.

FORM 1 — the structural `Tuple` `(| … |)` (locked token pair, owner 2026-07-07):
  - Lexer: the `(|` / `|)` token pair (`LParenPipe` / `PipeRParen`, maximal munch).
  - Parser + CST: the tuple TYPE in type position and the tuple LITERAL in expr
    position (positional + labeled), plus positional component access `t.0`
    (`MemberExpr` now accepts an `IntLit` selector). New CST accessors live in a
    cohesive `ck_syntax/src/tuple.rs` (the `ast/actors.rs` split precedent), not
    scattered free functions. E0130 / E0131 for an unclosed `(| … |)`.
  - Type system: a structural `Ty::Tuple(Vec<Ty>)` kind + `Ty::tuple` constructor
    (absorbing-`Unknown`, mirroring `nominal`/`func`), lift, render, arena-size
    (a product — Σ of components, vs a union's max), subst, and synth. Identity
    is by ordered component types, so labels are cosmetic and not carried.
    `assignable` grows one structural case: same arity, component-wise assignable.
  - Lowering: STOP — a tuple type-checks to `Ty::Tuple` but lowering it by the
    generic value-type law needs the name-free positional frame variant, and
    returning one by value (`alloc`'s `(| handle, arena |)`) needs the multi-word
    / multi-value ABI. Both are the values / function-call multi-value ABI slice.
    Landed as an honest `LowerError::TupleUnsupported` (the `SpawnUnsupported`
    precedent), never a silently-dropped node — no fake positional symbols minted.

FORM 2 — the general expression-bodied fn `fn f(params) -> R (where …)? = expr`:
  - Parser: the `= …` body dispatch is now a cohesive `FnBodyForm` strategy
    (block / `= intrinsic` / `= expr` / missing), so new body forms extend the
    enum rather than the dispatch chain. A `= expr` wraps in an `ExprBody` node.
    The retired "there is no `fn f() = expr`" E0119 hard-reject is gone.
  - CST: `FnDecl::body()` returns the `= expr` inner expression (a `+ expr_body()`
    accessor), so the resolver / lowerer / type-checker — which all consume
    `body()` and check the body root against `R` — treat `= expr` exactly like a
    block's trailing expression. The expr is thus type-checked against `R` and is
    the fn body with no new resolve/type/lower code; `signature_shape` excludes it.

Gates (from src/rust): fmt --check clean; clippy --all-targets -D warnings = 0;
build clean; test = 1267 pass / 0 fail (+15, baseline 1252 not regressed);
architecture R1–R4 green (R3/R4 caps unchanged — `syntax_kind.rs` docs trimmed to
fit, the tuple accessors split to `tuple.rs`). New tests: parser (positional +
labeled tuple type & literal, component access, `= expr` incl. a where-clause
case, the `body()` linchpin, round-trip); type system (tuple lift positional +
labeled, component-wise assignability, absorbing-`Unknown` ctor, display).
Make `Floor.ck` the live floor unit (coexisting with Memory/Sys) and rewire
the intrinsic seam off the SOURCE-NAMED opcode (`= intrinsic.<opcode>`), not
the fn name.

- Corpus: add `tests/corpus/stdlib/Floor.{ck,ckh}` — the closed floor's public
  surface (scalar leaves + usize/Region/Handle/TickHandle in the header) and
  its verbatim `intrinsic.<op>` bodies in the impl. `fn tick` omitted (pending
  Function<Ret>, actors slice). Compiles clean; floor_isa pin unchanged (the
  opcode-form bodies are not scraped as bare `= intrinsic`).
- Membership: `collect_unknown_intrinsics` recognizes a `mod Floor` fn whose
  body carries an opcode (via `FnDecl::intrinsic_opcode_span`) as a registered
  floor emission — the mechanical closed set, no per-name table. Memory/Sys
  bare-`= intrinsic` entries keep the name-keyed registry (coexist at A1).
- Targets: `build_intrinsic_targets` records the BODY OPCODE as the lowering
  target (fn name fallback for the coexisting bare compounds).
- Emitter: new `ck_codegen::format` — a format-driven strategy (Binary / Unary
  / IntCompare / FloatCompare / Convert) selected from the opcode; `icmp_<cc>`/
  `fcmp_<cc>` split into opcode + condcode. `is_machine_op`/`syscall_spec`
  re-keyed off the opcode (module-agnostic), old (module,op) arms retained.
- Test: `floor_arith` corpus app + `floor_arith_run` — a freestanding `-> Int`
  main calls `Floor::iadd`/`imul`/`isub`/`ineg` on `i64` operands and exits 42,
  exercising the new emitter end-to-end. Registered in `RUNTIME_TESTED`.

Gates: fmt/clippy/build clean; arch R1–R4 green; `cargo test --workspace`
exits 0.
mdoorn manually merged commit 933ef2b586 into master 2026-03-18 10:27:11 +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!62
No description provided.