Skip to content

fix: labeled statements emit compile error instead of silent wrong results#407

Merged
cs01 merged 2 commits intomainfrom
fix/labeled-statement-compile-error
Mar 15, 2026
Merged

fix: labeled statements emit compile error instead of silent wrong results#407
cs01 merged 2 commits intomainfrom
fix/labeled-statement-compile-error

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 15, 2026

Summary

  • Labeled statements (e.g., outer: for ... break outer) were silently dropped by both parsers, causing wrong results at runtime
  • Both parsers now emit a clear compile error suggesting to use a flag variable with regular break instead
  • Native parser uses if check before switch (workaround for native switch codegen not matching certain string cases)

Test plan

  • New test fixture edge-cases/labeled-statement.ts with @test-compile-error
  • Both node and native compilers reject labeled statements
  • npm run verify:quick passes

@cs01 cs01 merged commit 4c2a22e into main Mar 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant