Design decisions

177. Dream gaps get one error that names the construct (2026-11-21)

  • Decision. Each class of dream construct the front end does not have is reported once, at the construct, as E0504 "not implemented yet: (see design/…)" or "(not in the design)": a domain parameter fn f<domain D>, several domains on one domain line, a value on the indented lines after =, a line continued by an indented operator line, statements in parentheses (a; b), the range spelling lo <.. hi, a domain used as a value, the cuts of a domain spelled D.Cut (design §21.4; today D.bounds), an operator used as a value (compose: +, design stdlib/ranges.md §6.1; read as an error node), and a var binding inside a pattern ((var a, b); the binding is read as a plain name and its mutability is not checked, so the one error is the var). Planned forms met while the parser speculates are queued and reported only if that branch is kept. Sink::finish keeps only the first E0504 per message, since every later use of the feature is the same root cause. An unknown type close to a built-in or stdlib type says "not in the stdlib (yet)" beside the did-you-mean; a type used as a value is reported as a back-end limitation.
  • Why. The dream gate counted 29/60 dreams whose first error named the missing capability; generic "expected X" and mismatch errors hid what each dream needs. Each fix is a class of construct with a golden in crates/cpl-cli/tests/diagnostics/.
  • Reverse. Drop the entries from PLANNED in crates/cpl-syntax/src/planned.rs with their parser/checker call sites, the speculative_planned queue in crates/cpl-syntax/src/parser.rs, the E0504 dedup in Sink::finish, and the Dim::Enum arm in Lowerer::list.
  • Addendum. More classes are named the same way: match arms on the match line (match x: 0 => a; _ => b, read into real arms), let … in, maps {k: v} and sets {x for x in xs} in braces, m default 0, lazy[D] i => …, domain A = V if p(v), a pattern in place of a parameter name (fn f((r, c): Pt), design §14.1; the parameter binds and the pattern is unpacked on the body's first line, so later errors surface), some x patterns, [_]T, a <=> b then c <=> d, .member without its type, and types of literal values ('+' | '-'). A context with io(...) says "not implemented yet, and deferred" (DEFERRED in planned.rs). An indented if or match after = is the value (the core lane implemented it); any other indented value stays planned. let mut x is read as var x with a fix, and mut in a let condition is an error whose fix removes it. A capitalized unknown name is offered only capitalized names, since it is a type or a variant. Why: the owner's dream buckets (indented arms, stray tokens, ? in a branch, contexts); the gate went from 64/84 first errors and 167/219 errors named to 68/84 and 182/219. Reverse: drop the entries and their call sites, DEFERRED with Planned::deferred, and the let mut and label arms in stmt.rs, pattern.rs and item.rs.