Skip to content

fix(ir): preserve comprehension filter bindings across generators - #62

Merged
mremond merged 3 commits into
mainfrom
fm/task-0b8f75cb
Nov 15, 2026
Merged

mremond merged 3 commits into
mainfrom
fm/task-0b8f75cb

Conversation

@mremond

@mremond mremond commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Why

Filter-bound names must remain available to later comprehension qualifiers and templates, matching Erlang semantics.

What changed

  • Later generator sources, map keys, binary sizes and templates can read filter-bound values.
  • Short-circuit filters carry only definitely bound values, preserving outer iteration and shadowing.
  • Scope-sensitive diagnostics recognize bindings from earlier filters.

Before and after

Before: The requested comprehension failed compilation instead of producing its single expected result.

After: It now returns [258], and all 48 shared assertions match BEAM with both native scheduler configurations.

This change affects compiler bindings rather than an on-screen view; native and BEAM transcripts demonstrate the behavior.

Checked

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

Scenario Result Evidence
Read filter bindings in later sources and pattern inputs. ✅ Passed live The shared fixture returns [258] and completes all 48 assertions on native and BEAM.
Preserve bindings through deeper generators, shadowing and conditional rematches. ✅ Passed live Native default/single-scheduler and BEAM outputs match, including closures, deferred tails and 12 conditional rematches.
Preserve filter evaluation order and safely skip conditional bindings. ✅ Passed live Three exact traces and six short-circuit cases pass unchanged across all three executions.
  • Strict workspace lint: Passed with warnings denied.
  • Rust workspace tests: 2,213 passed; one release-only measurement intentionally ignored.
  • Full native suite: 521 passed, zero failed; two existing external-module tests skipped.
  • Allocator and stacktrace regressions: Default/override allocator checks and raising-first stacktrace checks passed.
How it was checked

Built the runtime before the compiler with cargo build --release --locked.

Ran the shared Erlang fixture on native default schedulers, NERA_SCHEDULERS=1 and OTP 29.

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

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

nera test -j 1 --timeout 30; python3 scripts/test-allocator-config.py; python3 scripts/test-stacktrace-order.py

Repeated full validation after preserving newer record-default diagnostic context. Local proof ran on macOS arm64; Windows execution was not performed.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Limited to comprehension lowering and scope-sensitive compiler diagnostics.
Behavior low Corrects valid-program rejection and filter binding propagation.
Undo low Reverting the commits needs no data or settings migration.
Evidence low 48 assertions pass on native and BEAM, with full local gate and independent review.
Sensitivity low No sign-ins, user data, keys or release paths change.
Novelty low Reuses existing binding analysis and generated-helper conventions.
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 50d5bde into main Nov 15, 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