docs(types): note TY8's payload typing feeds the system-unwinder landing pad #21

Manually merged
dferreira merged 4 commits from feat/021-docs-types-note-ty8-s-payload-typing-feeds-the into master 2026-01-23 13:00:00 +01:00
Owner

docs(types): note TY8's payload typing feeds the system-unwinder landing pad

Along the way:

  • types: lock the five type-declaration keywords + named lowercase parameters
  • parser+types: land type-declaration parsing and named lowercase parameters
  • parser: retire the (N) size-bound suffix; size is a type-level argument

Touches 36 files: docs/impl/03-parser.md, docs/impl/memory-model/arenas.md, docs/impl/type-system/TY8-or-surface-and-panic-payloads.md, docs/traits.md, docs/types.md, scripts/test.sh and 30 more.

docs(types): note TY8's payload typing feeds the system-unwinder landing pad Along the way: - types: lock the five type-declaration keywords + named lowercase parameters - parser+types: land type-declaration parsing and named lowercase parameters - parser: retire the (N) size-bound suffix; size is a type-level argument Touches 36 files: `docs/impl/03-parser.md`, `docs/impl/memory-model/arenas.md`, `docs/impl/type-system/TY8-or-surface-and-panic-payloads.md`, `docs/traits.md`, `docs/types.md`, `scripts/test.sh` and 30 more.
Author
Owner

Split. The decision in parse_empty_literal_turbofish is a pure function now, with its own tests in src/rust/crates/ck_parser/src/expr.rs.

Split. The decision in `parse_empty_literal_turbofish` is a pure function now, with its own tests in `src/rust/crates/ck_parser/src/expr.rs`.
dferreira approved these changes 2026-01-23 12:55:00 +01:00
dferreira left a comment

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

A clear improvement. The change in `src/rust/crates/ck_parser/src/expr.rs` is the part I would have argued for.
@ -308,0 +354,4 @@
/// child, so the existing record-literal AST projection walks it
/// unchanged. Caller has verified the shape via
/// [`Self::at_empty_literal_turbofish`].
fn parse_empty_literal_turbofish(&mut self) {
Owner

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

`parse_empty_literal_turbofish` reads, decides and writes in one function. The deciding part is the piece I would want to test on its own. Worth splitting?
The 2026-05-28 lowering switch (HIR → Floor IR → Cranelift; `Panic::raise`
through the system unwinder) turns TY8 goals #4 / #5 from "what the type
check produces" into "what F2 codegen consumes for landing-pad layout."
TY8 doesn't grow a responsibility; the regression cost does. Added one
subsection in `## Design` between the `Error` existential and `## What's
open`, plus a sentence on how TY4's coherence table backs the existential
dispatch.
The Q4 resolution from this session's design pass. The type-declaration
universe is exactly five keywords (`type`, `newtype`, `record`, `data`,
`trait`), each with one job; `composes` mixes in traits only, never other
newtypes/records/data; lowercase parameters on `newtype` / `trait` /
`record` contribute a field of the same name AND participate in type
identity (so `String<size: u8>` means every String value carries
`s.size: u8` *and* `String<12> != String<13>`); `data` variants grew an
optional turbofish slot for the type-level discriminator
(`AdminRole::<Admin>(Duration)`); trait names are barred from
value-position type annotations as a hard parse/type error to keep the
no-subtyping lock honest.

Lands in `docs/types.md` (new "Five type-declaration keywords" section,
extended "Collections carry a maximum size" with the parameter-as-field
mechanism) and `docs/traits.md` (new "Named lowercase parameters"
section, sharpened "Traits are bounds, not types" with the parse-error
clause).

`tests/corpus/types/` is the worked demonstration corpus:
- Aliases.ck — `type` as alias only
- Bounded.ck — Sized / Collection traits + List / Map / RingBuffer
- Roles.ck — type-level tag mint via `newtype Role<tag: Name>`, the
  `data Roles` sum that gathers them, and retag-via-`with`

The corpus is intentionally future CkLang: six grammar slices remain to
lift before it parses cleanly (`type` keyword, `newtype` keyword,
lowercase-named generic params, variant turbofish slot,
`{}::<T> with` empty-literal turbofish, `where` on free fns).
`scripts/test.sh --corpus[:NAME[:FILE]]` drives the smoke harness in
`crates/ck_parser/tests/corpus.rs` so the picture is one command away.
Parse the five type-declaration keywords and named lowercase parameters
through the front-end (lexer, parser, resolve, types), with new parser
tests for type decls, size bounds, and with-expressions.
`List<Int, 12>` is canon — the bounded-collection size is the `size` named
lowercase parameter filled positionally inside the generic list, like any
generic argument (`parse_generic_args` already accepts the IntLit slot). The
parallel `List<Int>(12)` paren-suffix form was internal drift.

Remove the `SizeBound` node + `parse_size_bound` reader + E0113/E0114, delete
the size_bound.rs test file, and reconcile docs (types.md, 03-parser.md,
arenas.md) to the angle-bracket form. Ratchet MAX_FILE_LOC 800 -> 798 to track
syntax_kind.rs shrinking. Also fixes two clippy errors (-D warnings) that
landed in cb3a27f: a missing semicolon in instantiate.rs and a doc-markdown
backtick.
dferreira manually merged commit e1f1fd47a1 into master 2026-01-23 13:00:00 +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!21
No description provided.