Skip to content

fix: emit error for x++/x-- at global scope instead of silently dropping#234

Merged
cs01 merged 1 commit intomainfrom
fix/global-increment-error
Mar 11, 2026
Merged

fix: emit error for x++/x-- at global scope instead of silently dropping#234
cs01 merged 1 commit intomainfrom
fix/global-increment-error

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 11, 2026

Summary

  • x++ and x-- at global scope were silently dropped by both parsers, producing wrong values (variable unchanged)
  • now both parsers detect unary expressions at global scope and emit a clear error with workaround suggestion
  • increment/decrement works correctly inside functions — this only affects top-level code

Test plan

  • verify:quick passes (tests + stage 1 self-hosting)
  • confirmed compiler source doesn't use x++/x-- at global scope

🤖 Generated with Claude Code

@cs01 cs01 merged commit ade080f into main Mar 11, 2026
12 checks passed
@cs01 cs01 deleted the fix/global-increment-error branch March 12, 2026 05:35
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