E-MATCH-EFFECT-FORBIDDEN
effect=
attribute used on a state-child inside a
<match>
block.
What it means
The
effect=
attribute is the per-rule inline form of a transition effect
— sibling to
<onTransition>.
Effects presuppose that a transition occurs. Block-form match
is rules-inert: nothing transitions inside it (the matched-on
value either is or isn't a given variant). So
effect=
is structurally meaningless on a match arm. The compiler
forbids it as an error, not a lint — its presence
indicates the wrong primitive.
Minimal reproducer
type Phase:enum = { Idle, Loading, Done }
<match for=Phase>
<Idle></>
<Loading effect=${ analytics.track("load") }></>
// ^^^^^^^
// E-MATCH-EFFECT-FORBIDDEN: effect= on match arm.
// Promote to <engine> to activate effects.
<Done></>
</match>
How to fix
Promote to
<engine>.
Same case-analysis shape;
effect=
and
<onTransition>
become legal:
<engine for=Phase initial=.Idle>
<Idle rule=.Loading />
<Loading rule=.Done effect=${ analytics.track("load") } />
<Done rule=.Idle />
</engine>
effect= vs <onTransition>
Inside an engine,
effect=
is the shorter form for single-target rules. Multi-target
rules fire
E-ENGINE-EFFECT-AMBIGUOUS
because the destination is ambiguous — use
<onTransition>
instead, which filters by from / to / once / if.
Related
- <match> — element reference. Rules-inert Tier 1.
- <engine> — Tier 2 promotion target. effect= becomes legal here.
- E-MATCH-ONTRANSITION-FORBIDDEN — sibling error for the <onTransition> long form.
- W-MATCH-RULE-INERT — companion warning for rule= (legal but inert).
- E-ENGINE-EFFECT-AMBIGUOUS — effect= on a multi-target rule inside an engine.
Specification
Normative text: SPEC §18.0.2 (match attribute legality), §51.0.H (effect= in engine context), §34 catalog row. Spec lives at compiler/SPEC.md .