scrml.dev v0.7.1
Reference › Errors

E-ENGINE-STATE-CHILD-MISSING

An <engine> body is missing a state-child for one of its variants.

Error Compile-time SPEC §51.0.B (normative)

What it means

An engine is a total function over its type's variants: every variant must have a corresponding state-child. This is the same exhaustiveness guarantee <match> gives, and it holds over time — adding a variant to the enum later re-fires this error at every engine over that type, so the compiler hands you the complete list of places that need updating.

Minimal reproducer

This is the exact source compiled against the linked compiler and verified to produce E-ENGINE-STATE-CHILD-MISSING.

<program title="p">
    type Phase:enum = { Idle, Busy, Done }
    <engine for=Phase initial=.Idle>
        <Idle rule=(.Busy)>idle</>
        <Busy rule=(.Done)>busy</>
    </>
</>

How to fix

  1. Add the missing state-child. <Done rule=(…)>…</>. Preferred when the state genuinely needs rendered UI or transitions.
  2. Remove the variant from the enum. If a variant is unreachable, deleting it from the type is the honest fix — an engine that cannot enter a state is a sign the type is too wide.

Related

Specification

Normative text: §51.0.B, §51.0.F, §56.6.2, §34. Spec lives at compiler/SPEC.md .

← Reference