Skip to content

fix(ir): capture bound catch classes in funs - #64

Merged
mremond merged 1 commit into
mainfrom
fm/task-9e2b9dbd
Nov 16, 2026
Merged

mremond merged 1 commit into
mainfrom
fm/task-9e2b9dbd

Conversation

@mremond

@mremond mremond commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Why

A fun using an outer bound name only as its catch class must match that value instead of catching a mismatching exception.

What changed

  • Funs capture values read only as catch classes.
  • Unused-variable diagnostics recognize those outer binding reads.
  • Native and BEAM regressions protect matching, mismatching, nested and named funs, comprehension helpers and shadowing.

Before and after

Before: The reproduction returned wrong natively but right on BEAM; the regression fixture produced six false unused-variable warnings.

After: The reproduction returns right on both runtimes, and the fixture produces zero unused-variable warnings.

This changes compiler diagnostics and generated program behavior, not a graphical view.

Checked

Live validation: Awaiting live validation. This version and evidence need an independent review of coverage and proof.

  • Native and BEAM reproduction: Both return right for the fun and direct forms.
  • Unused-variable diagnostics: No false unused warnings; both compilers retain the intentional fun-head shadow warning.
  • Repeated regression runs: Both warning tests and the shared native/BEAM fixture passed ten consecutive rounds without retries.
  • Local project gate: Runtime-first release build, clippy, 2,226 Rust tests, 525 native tests, allocator and stacktrace checks passed; one Rust test ignored and two native tests skipped.
How it was checked

cargo build --release --locked -p nera-runtime -j 4, then 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: 2226 passed, 0 failed, 1 ignored

python3 scripts/test-allocator-config.py

./target/release/nera test -j 1 --timeout 30: 525 passed, 0 failed, 2 skipped

python3 scripts/test-stacktrace-order.py

cargo test --locked -p nera-ir warnings::unused_vars::tests:: and the new native/BEAM fixture: 10 consecutive passes each

Independent code and retained-proof review passed.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Catch-class collection in the existing shared AST reference walker.
Behavior low Corrects a mismatching exception catch and false unused-variable warnings.
Undo low A revert restores the previous behavior; no saved data changes.
Evidence low Real native and BEAM execution plus diagnostic proof passed independent review.
Sensitivity low No credentials, user data, signing or release changes.
Novelty low Adds an omitted reference beside existing pattern-reference collection.
Dependencies low No dependency changes.
Not done

Windows execution was not run locally; hosted checks cover the configured Linux and macOS jobs.

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