scrml.dev v0.7.1
Reference › Errors

E-MATCH-NOT-EXHAUSTIVE

Block-form <match for=Type> is missing variants of Type and has no wildcard <_> catch-all.

Error Compile-time SPEC §18.0.1 (normative)

What it means

Block-form match is the canonical Tier 1 commitment for case analysis on an enum: a structural exhaustiveness check. The compiler verifies at compile time that every variant of the discriminating type has a state-child arm OR that a wildcard <_> arm catches the rest. If neither, E-MATCH-NOT-EXHAUSTIVE fires.

Minimal reproducer

type Phase:enum = { Idle, Loading, Done, Error }

<match for=Phase>
  <Idle>Press load</>
  <Loading>Working…</>
  // missing .Done + .Error AND no <_> wildcard
  // E-MATCH-NOT-EXHAUSTIVE fires here
</>

How to fix

  1. Add the missing variants. Preferred when the missing states genuinely need rendered UI. The compiler enforces this is the COMPLETE list of variants of the type — adding a new variant to the enum LATER will re-fire this error at every site, surfacing every place that needs updating.
  2. Add a wildcard <_> arm. Catches anything not enumerated. Use when the missing variants legitimately share UI — e.g., "any non-Active state shows the same logout button."
  3. Reconsider the type if you find yourself routinely needing to wildcard most of an enum. The enum may be carrying too many states; consider splitting or refining.

Promotion path

Block-form <match> is Tier 1 of the case-analysis ladder. State-children carry forward verbatim to Tier 2 <engine> — the wrapper swap is the commitment moment. Same exhaustiveness check, plus active rules + transition handlers. See I-MATCH-PROMOTABLE for the lint that nudges the promotion + SPEC §56 promotion ergonomics.

Related

  • <match> — element reference. Block-form Tier 1 shape.
  • <engine> — Tier 2 promotion target. Same exhaustiveness; adds active rules.
  • W-MATCH-RULE-INERT — rule= legal-but-inert in match.
  • E-VARIANT-AMBIGUOUS — arm pattern can't resolve to a unique enum context.

Specification

Normative text: SPEC §18.0.1 (block-form match shape and exhaustiveness rule), §14.10 (bare-variant inference; cross-ref for arm patterns), §34 catalog row. Spec lives at compiler/SPEC.md .