Skip to content

fix(ir): reject same-head inputs at every pattern site - #57

Merged
mremond merged 1 commit into
mainfrom
fm/task-ea62167f
Nov 15, 2026
Merged

mremond merged 1 commit into
mainfrom
fm/task-ea62167f

Conversation

@mremond

@mremond mremond commented Nov 15, 2026

Copy link
Copy Markdown
Member

Why

Match erlc by rejecting map keys and binary sizes supplied only by the pattern being matched.

What changed

  • Reject invalid inputs in function and control-flow clause heads.
  • Apply the same checks to ordinary and conditional body matches.
  • Preserve prior bindings, completed right-hand-side inputs and sequential binary sizes.

Before and after

Before: Nera accepted ten invalid programs that erlc rejects.

After: Nera rejects all ten programs while valid prior inputs and sequential binary sizes still execute correctly.

This compiler change has no graphical view; retained command outputs demonstrate the diagnostics and native completion checks.

Checked

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

Scenario Result Evidence
Reject map keys and binary sizes supplied only by their own pattern. ✅ Passed live Real compiler and erlc diagnostics agree for all ten invalid source fixtures.
Keep prior inputs and sequential binary sizes valid at every affected pattern site. ✅ Passed live The unchanged valid fixture completes on BEAM and passes the native runner's explicit completion check.
Preserve bundled and upstream Erlang compilation and execution. ✅ Passed live The full local compiler/native gate, repeated regressions and complete scoped Cowlib/Thoas integrations pass.
  • Rust gate: Clippy and all 2,205 workspace tests pass; one existing release-only scaling test remains ignored.
  • Native suite: 516 tests pass; two existing external-module skips remain.
  • Repeated regressions: All 270 diagnostics tests and eleven new native fixtures pass ten consecutive rounds without retries.
  • Pinned integrations: Cowlib 122/122, Thoas 80/80, both OTP probes and 36 native assertion bodies pass.
  • Additional native checks: Allocator configuration and uncaught stacktrace-order checks pass.
How it was checked

cargo build --release --locked -j 4

cargo clippy --workspace --all-targets --locked -j 4 -- -D warnings

cargo test --workspace --locked --no-fail-fast -j 4 -- --test-threads=4

./target/release/nera test -j 1 --timeout 30

python3 scripts/test-allocator-config.py; python3 scripts/test-stacktrace-order.py

Complete Cowlib and Thoas integration harnesses, differential corpora, OTP probes and native assertion bodies ran on macOS arm64.

Cowlib's upstream build required a disposable path without spaces; its initial failure occurred before Nera and the unchanged pinned source passed under that path.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low One existing compiler diagnostic pass and its regression fixtures.
Behavior low Rejects invalid Erlang patterns to match erlc.
Undo low A code revert restores the previous compiler behavior.
Evidence low Real compiler diagnostics, native execution and OTP comparisons pass.
Sensitivity low No sign-ins, keys, payments or saved user data change.
Novelty low Reuses the existing pattern-input checker at missing callers.
Dependencies low No dependency changes.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 15, 2026
@mremond
mremond merged commit 612b43d into main Nov 15, 2026
22 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