E-NAME-COLLIDES-STATE
A local declaration shadows a registered reactive state cell.
What it means
scrml resolves reactive cells at the identifier level, which is what lets the compiler treat "no @-reference" as a reliable signal that a function touches no reactive state. A local named the same as an existing cell breaks that property and makes reading the code ambiguous for a human too — is count the local or the cell? Shadowing is therefore rejected rather than resolved by precedence.
Minimal reproducer
This is the exact source compiled against the linked compiler and verified to produce E-NAME-COLLIDES-STATE.
<program title="p">
<count> = 0
function go() {
const count = 5
return count
}
<button onclick=go()>go</button>
</>
How to fix
- Rename the local. The cell keeps its name and the local takes a distinct one. This is almost always the right fix.
-
Read the cell directly if that was the intent.
If the local existed only to snapshot the cell, use
@nameat the use site instead.
Related
Specification
Normative text: §1.6, §3.4, §6.1.3, §6.1.4, §7.6.1, §34. Spec lives at compiler/SPEC.md .