01. Parser — : trait clause on type_def
Goal
Implement proposal §6.1 grammar: type_def = "type" identifier [ generics ] [ ":" trait_list ] [ where_clause ] "=" type_body [ ";" ], trait_list = trait_ref { "," trait_ref }. The clause sits between generics and where, before =. Comma-separated (distinct from impl’s +-separated bounds).
Implementation Sketch
compiler_repo/compiler/ori_parse/src/grammar/item/type_decl.rs:parse_type_decl_body parses the optional : trait list after identifier+generics, before where/=. Per BUG-06-005 §02 unanimous /tp-help consensus: add a dedicated AST field on ori_ir TypeDecl (ast/items/types.rs:48) — do NOT reuse derives (LEAK + fmt round-trip break). Partition at parse time via DerivedTrait::from_name(): markers (Value/Sendable) and derivables (Eq/Clone/…) stored distinctly. #derive(...) attribute parsing removed (§6.7) — but corpus migration to : is staged (§03 stdlib, §08 tests) so removal lands after migration to avoid mass breakage.
Implementation Items
- grammar.ebnf already covered by §07; parser implements
:trait_list inparse_type_decl_body(after generics, before where/=) -
ori_irTypeDecl: dedicated declaration-bounds field(s); update incremental copier (ori_parse/src/incremental/copier/decl.rs:122) + everyTypeDecl{}constructor (codex-F8) - Parse-time partition markers vs derivables (opencode-F4)
- Parser tests (write FIRST, verify fail): struct/sum/newtype bounds, multi-bound, generics+where interaction, disambiguation
Spec References
compiler_repo/docs/ori_lang/proposals/approved/capability-unification-generics-proposal.md§6.1, §6.7, §6.8- BUG-06-005 §01 RCA + §02 design consensus
Tests
compiler/ori_parse/src/grammar/item/type_decl/tests.rs (or sibling) — declaration-bound parsing matrix.
Intelligence Reconnaissance
- Graph-grounded during BUG-06-005 investigation + the dual-source /tp-help consensus (
bug-tracker/plans/BUG-06-005/section-02-fix-consensus.md): reviewers ranfile-symbols/callers/callees/symbolsoverori_parse/grammar/item,ori_ir/ast/items/types.rs,ori_types/check/registration,ori_fmt,ori_eval/derives,ori_llvm/codegen/derive_codegen. Per-section graph queries to be re-run at /review-plan pre-implementation gate. (2026-06-01)