Skip to content

Fix parser crash on reserved pattern binders - #106

Merged
liufengyun merged 1 commit into
mainfrom
fix-reserved-pattern-binder-crash
Sep 4, 2026
Merged

Fix parser crash on reserved pattern binders#106
liufengyun merged 1 commit into
mainfrom
fix-reserved-pattern-binder-crash

Conversation

@liufengyun

Copy link
Copy Markdown
Contributor

Fix parser crashes on reserved words in value binder positions.

Summary

  • reject an empty expression pattern with a source-located parser diagnostic
  • cover section in both val and for binder positions
  • cover the other reported block keywords (union, view, interface, and namespace)

Checklist

  • Added parsing regression tests under tests/parsing/
  • Docs updated if the change affects user-visible behavior — diagnostics only
  • All commits are signed off (why?)

Security impact

No.

Compatibility impact

Reserved words used as pattern binders now produce a parser diagnostic instead of crashing. Valid source syntax and serialized formats are unchanged.

  • Source compatibility: existing valid code continues to compile
  • SAST compatibility
    • forward compatibility: new libraries can be used by old compiler
    • backward compatibility: old libraries can be used by new compiler
  • Standard Library compatibility
    • forward compatibility: new code can work with old stdlib
    • backward compatibility: old code works with the new stdlib
  • Runtime Library compatibility
    • forward compatibility: new code can work with old runtime
    • backward compatibility: old code works with the new runtime
  • Build tool
    • Build spec compatibility: old projects continue to build
    • Joy package compatibility: old .joy files can be consumed by the new build tool

Verification

  • bin/fuzz regress --parse tests/parsing — all 20 files pass without crashes
  • direct parser replay of all six new cases reports Expect a pattern, found token ...
  • git diff --check

Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
@liufengyun
liufengyun requested a review from everdance September 2, 2026 09:50
@liufengyun
liufengyun merged commit fe8c443 into main Sep 4, 2026
1 check passed
@liufengyun
liufengyun deleted the fix-reserved-pattern-binder-crash branch September 4, 2026 09:00
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.

2 participants