Skip to content

fix(parser): reject bare binary comprehension bodies that need parentheses - #101

Merged
mremond merged 1 commit into
mainfrom
infinitary-batch/ef6910b0
Nov 30, 2026
Merged

mremond merged 1 commit into
mainfrom
infinitary-batch/ef6910b0

Conversation

@mremond

@mremond mremond commented Nov 30, 2026

Copy link
Copy Markdown
Member

Why

Nera accepted bare binary comprehension bodies that the Erlang compiler rejects.

What changed

  • Bare calls, signed expressions, maps, records and record indexes now produce a compile error with a parentheses hint.
  • The formatter leaves rejected forms as written and keeps required parentheses in valid code.

Before and after

Before: Nera built all six rejected examples, and formatting inserted parentheses that made the code acceptable to the Erlang compiler.

After: Nera rejects all six examples without writing an executable, and seven valid controls compile and keep their result.

The change appears in compiler diagnostics and formatted source text; the terminal transcripts record both.

Checked

Live validation: Demonstrated for this version. 2 of 2 scenarios driven live in the product.

Scenario Result Evidence
Build and format rejected bare bodies ✅ Passed live Both compilers rejected all six examples; Nera wrote no executable and left the source unchanged.
Build, run and format valid bodies ✅ Passed live Both compilers produced matching results for seven controls; the Erlang compiler accepted their formatted source.
  • Compiler agreement: Nera and the Erlang compiler agreed on all 67 checked forms.
  • Formatter output: All 827 tracked Erlang files formatted identically.
  • Rust workspace: Clippy passed; 2,301 tests passed with one ignored under the standard file creation mask.
  • Native suite: 552 tests passed; two require external OneCached modules and were skipped.
  • Independent review: The formatter now relies on the parser’s grammar; focused tests confirmed no output change.
How it was checked

The three changed regressions failed against the original parser. Both focused test files passed ten runs at the final version.

The native suite ran before the formatter-only review change. The final workspace run and formatter comparison included that change.

The original workspace run with a group-writable file creation mask hit a storage fixture failure also reproduced on unchanged main.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Only binary comprehension body parsing and formatting changed.
Behavior low Previously accepted syntax now reports the error already required by Erlang.
Undo low Reverting the change needs no data or settings migration.
Evidence low Real builds, runtime output and formatting confirmed the change end to end.
Sensitivity low No sign-ins, user data or release behavior changed.
Novelty low The parser and formatter use their existing error and preservation paths.
Dependencies low No dependencies changed.

…heses

Bare calls, signed expressions, maps, records and record indexes now produce a compile error with a parentheses hint.

The formatter leaves rejected forms as written and keeps required parentheses in valid code.
@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 30, 2026
@mremond
mremond merged commit d459f43 into main Nov 30, 2026
22 checks passed
@mremond
mremond deleted the infinitary-batch/ef6910b0 branch November 30, 2026 17:57
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