Skip to content

fix(warnings): count reads after exported branch bindings - #65

Open
mremond wants to merge 3 commits into
mainfrom
fm/task-0418a43a
Open

mremond wants to merge 3 commits into
mainfrom
fm/task-0418a43a

Conversation

@mremond

@mremond mremond commented Nov 15, 2026

Copy link
Copy Markdown
Member

Why

Reads after case, if and receive branches should count as uses instead of producing false unused-variable warnings.

What changed

  • Remove false unused-variable warnings for branch bindings read afterward, including nested branches and captures.
  • Keep warnings for unread values while respecting local scopes, shadowing and conditional-pattern comparisons.
  • Add warning regressions backed by native and BEAM execution.

Before and after

Before: The existing nested-case fixture produced 21 false unused-variable warnings.

After: The same fixture produces zero unused-variable warnings, while all eleven genuinely unused controls still warn.

This changes compiler diagnostics, not a graphical view; compiler transcripts and native execution verify the result.

Checked

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

Scenario Result Evidence
Branch exports read afterward ✅ Passed live Actual check/build output has no false unused warnings; native completion matches OTP 29, including conditional comparisons and captures.
Genuinely unused bindings ✅ Passed live Compiler check/build and erlc report the same eleven unused controls; exact warning assertions pass ten consecutive rounds.
Original nested-case regression ✅ Passed live The unchanged fixture goes from 21 false unused warnings to zero, and native completion matches BEAM.
  • Full Rust workspace: 2,215 tests passed; no failures.
  • Release build and strict clippy: Both passed.
  • Full native suite: 522 passed; two documented external-module skips; no failures.
  • Allocator and stacktrace probes: Both passed.
How it was checked

cargo test --locked -p nera-ir -j 4: 478 unit and 49 integration tests passed.

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.

python3 scripts/test-allocator-config.py; NERA_SCHEDULERS=4 ./target/release/nera test -j 1 --timeout 30; python3 scripts/test-stacktrace-order.py.

Ten consecutive runs of all 293 warning tests and the branch_export_warnings native fixture passed without retries.

Direct check/build diagnostics and native program output matched erlc -Wall and OTP 29 on macOS arm64. Independent code review found no remaining defect.

Risk

Risk above low: Blast radius, medium — Warning traversal and shared read collection also feed closure capture analysis.

Full risk assessment
Dimension Level Why
Blast radius medium Warning traversal and shared read collection also feed closure capture analysis.
Behavior low Corrects false warnings while retaining genuinely unused bindings.
Undo low Reverting the code requires no data or settings migration.
Evidence low Actual compiler diagnostics and native results agree with BEAM; the full local gate passed.
Sensitivity low No sign-ins, saved data, signing or payment behavior changes.
Novelty low Extends existing warning walkers and reuses shared binding and reference collectors.
Dependencies low No dependencies change.

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
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