You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and then all three arms fall through to shadow_input, which unconditionally closes with [10, ""]]. On the None arm that trailing ] has no matching [, which is exactly the malformed output above.
Expected
The same conclusion as #302: once an expression diagnostic is emitted, either no artifact should be written, or the output should stay valid JSON (for instance emitting [1,[10,""]] for the unresolved input).
Observed at 0a592e276f4aad8f7acefb1c36d8a383dec43661 (2026-06-19, i.e. after Build emits invalid project.json after expression diagnostics #302 was closed), building the crate with wasm-pack --target web and calling build() from JavaScript rather than through the CLI — that is where the exact bytes above come from. The name_input / shadow_input code path is still present on main today, but I have not rebuilt main to confirm it at runtime, so it is possible a later change already covers it.
Practical impact for a downstream consumer: because an artifact is produced, a naive integration hands the .sb3 straight to a player and gets a JSON SyntaxError at load time instead of a compiler error, which is very confusing to end users. We now validate the zip's project.json before running it.
Repro
Same shape as the repro in #302:
fantasmais never declared.Actual
The compiler reports
unrecognized variableforfantasmaand still writes an.sb3. The generatedproject.jsonis invalid JSON:json.loads(andJSON.parse) fail at that position, so the resulting project cannot be opened by Scratch or TurboWarp.Where it comes from
In
src/codegen/input.rs,name_inputwrites the opening bracket only when the name resolves:Some(QualifiedName::Var(..))→ writes[3,[12,name,name],Some(QualifiedName::List(..))→ writes[3,[13,name,name],None→{}, writes nothingand then all three arms fall through to
shadow_input, which unconditionally closes with[10, ""]]. On theNonearm that trailing]has no matching[, which is exactly the malformed output above.Expected
The same conclusion as #302: once an expression diagnostic is emitted, either no artifact should be written, or the output should stay valid JSON (for instance emitting
[1,[10,""]]for the unresolved input).Notes
value_input(theNaN/Infinityarms), this one goes throughname_input.0a592e276f4aad8f7acefb1c36d8a383dec43661(2026-06-19, i.e. after Build emits invalid project.json after expression diagnostics #302 was closed), building the crate withwasm-pack --target weband callingbuild()from JavaScript rather than through the CLI — that is where the exact bytes above come from. Thename_input/shadow_inputcode path is still present onmaintoday, but I have not rebuiltmainto confirm it at runtime, so it is possible a later change already covers it..sb3straight to a player and gets a JSONSyntaxErrorat load time instead of a compiler error, which is very confusing to end users. We now validate the zip'sproject.jsonbefore running it.