Repository navigation
Fix parsing of ReScript compiler syntax examples - #309
Conversation
Valid syntax from compiler printer fixtures was rejected by missing grammar rules and premature automatic semicolon insertion. Support additional type constraints, escaped type variables, extensible types, functors, patterns, decorator payloads, and expression forms. Preserve declaration continuations across newlines and comments. Add 28 regression tests organized by syntax category and document compiler validation limits for the standalone examples. Validation: 185 corpus tests pass; 2,084 wild files parse without errors. Signed-off-by: Pedro Castro <aspeddro@gmail.com>
Valid syntax from compiler printer fixtures was rejected by missing grammar rules and premature automatic semicolon insertion. Support additional type constraints, escaped type variables, extensible types, functors, patterns, decorator payloads, and expression forms. Preserve declaration continuations across newlines and comments. Add 28 regression tests organized by syntax category and document compiler validation limits for the standalone examples. Validation: 185 corpus tests pass; 2,084 wild files parse without errors.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de0c5af277
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…n_relation precedence. `call(~x=1 + 2 : int :> int)` now coerces the entire sum, preserving existing parenthesized trees. Signed-off-by: Pedro Castro <aspeddro@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 685d8534ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Remove forced precedence from source-typed coercions so an outer colon can follow a completed nested ternary without error recovery. Preserve full-expression coercions and declare the resulting rule conflicts. Add regression coverage for nested numeric and identifier branches, including a nested consequent with an explicit source-typed coercion.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31fba5ad66
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Prefer complete unescaped character literals over type-variable tokens when a ternary colon can also introduce a source-type annotation. Preserve escape-sequence nodes and type-variable coercions. Add regression coverage for simple, nested, escaped, and coerced character-valued ternaries and regenerate the parser.
Summary
ReScript compiler printer fixtures exposed missing grammar rules and premature automatic semicolon insertion. This PR allows those constructs to parse without
ERRORorMISSINGnodes and adds 28 regression tests organized by syntax category.Declaration continuations
Newlines and comments before
constraintor a binding's=no longer terminate the declaration:Extensible types and constructor rebindings
Support private extensible types and constructor aliases, including qualified aliases and decorated constructors:
Functors
Support bare and anonymous functor parameters, unit parameters, and type annotations on functor arguments:
Expression receivers and labeled arguments
Braced expressions can be used as call, member-access, and subscript receivers. Labeled arguments now accept punned type annotations and combined source-type/coercion annotations:
Additional Coverage
&) and escaped type variables.The generated parser and node metadata are updated. The ReScript development dependency is updated to
13.0.0-alpha.7for compiler validation.Validation
npm test: 185/185 corpus tests passed, including 28 new cases; highlighting assertions passed.node scripts/test_wild.mjs: 2,084 files across 11 projects, zero parse errors.npm run lintandnpm run checkformat: passed.git diff --check: passed.npx bscand parsed withnpm run parse --.The standalone examples were checked locally under the Git-ignored
test_wild/to-fixdirectory. Four examples preserve unsupported extension or semantically invalid printer fragments inside custom@syntax(...)attribute payloads: the compiler validates their syntax but does not type-check or expand those payloads. The corpus includes the original unwrapped snippets; successful Tree-sitter parsing does not imply successful type checking or extension execution.