Reference › Errors
E-ENGINE-EFFECT-AMBIGUOUS
effect= on a state-child whose rule= has multiple targets.
What it means
effect= attaches one side effect to one transition. When rule= names several possible targets, the compiler cannot tell which transition the effect belongs to — running it on all of them and running it on one are both defensible readings, so it refuses to choose. Single-target rules keep effect= unambiguous.
Minimal reproducer
This is the exact source compiled against the linked compiler and verified to produce E-ENGINE-EFFECT-AMBIGUOUS.
<program title="p">
type Phase:enum = { Idle, Busy, Done }
function ping() { return 1 }
<engine for=Phase initial=.Idle>
<Idle rule=(.Busy | .Done) effect=${ping()}>idle</>
<Busy rule=(.Done)>busy</>
<Done rule=(.Idle)>done</>
</>
</>
How to fix
-
Use
<onTransition to=…>children. This is the canonical multi-target form: one child per transition, each with its own body. Explicit about which effect belongs to which edge. -
Narrow the rule to a single target.
If the state really only transitions one way,
effect=is fine oncerule=reflects that.
Related
Specification
Normative text: §51.0.H, §55.15, §34. Spec lives at compiler/SPEC.md .