scrml.dev v0.7.1
Reference › Errors

E-ENGINE-VAR-DUPLICATE

An engine's auto-declared variable collides with a separate declaration.

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

What it means

<engine for=Phase> auto-declares @phase — the engine owns that cell and is the only thing permitted to write it. Declaring a cell of the same name separately produces two competing owners for one identifier, so the compiler rejects the duplicate rather than picking a winner.

Minimal reproducer

This is the exact source compiled against the linked compiler and verified to produce E-ENGINE-VAR-DUPLICATE.

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

How to fix

  1. Delete the manual declaration. The engine already provides the cell; just read @phase. This is almost always the fix.
  2. Rename one of them. If you genuinely need a second, independent cell, give it a distinct name.

Related

Specification

Normative text: §51.0.C, §34. Spec lives at compiler/SPEC.md .

← Reference