Skip to content

tests: pin inline-lambda type-variable params across engines#326

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/lambda-typevar-scope
May 17, 2026
Merged

tests: pin inline-lambda type-variable params across engines#326
danieljohnmorris merged 1 commit into
mainfrom
fix/lambda-typevar-scope

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

nlp-engineer rerun6 reported rsrt (r:L a>n;at r 0) rows failed with cascading ILO-T002 duplicate function definition 'a' and ILO-P001 expected declaration, got RParen against v0.11.5, inferring the lambda-lifter was treating type-var a as a top-level fn name.

I couldn't reproduce against f6b3271. Every variant of the reported shape now parses, verifies, and runs identically across tree, VM, and Cranelift. src/verify.rs:170-182 already treats unaliased single lowercase letters (other than n/t/b) as type variables that lower to Ty::Unknown, and the lifter in src/parser/mod.rs always names synthetic decls __lit_N. Most likely the bug was closed in passing by one of the v0.11.4 to v0.11.5 parser/lambda fixes (#321 hof-error-parity, #324 bare-bang-nil, listlit-fnref-greedy, etc.).

Rather than just close the entry, this is a defensive regression-test-only PR pinning every variant of the reported shape so it can't regress silently in the future.

Repro (current state — no error)

main >n;
  rows=[[1.5,2],[2.5,3]];
  by-pmi=rsrt (r:L a>n;at r 0) rows;
  0

Runs clean on tree, VM, and Cranelift. Same for every variant the persona could plausibly have meant.

What's in the diff

  • tests/regression_inline_lambda_typevar.rs (12 cross-engine cases):
    • identity (x:a>a;x) over map
    • polymorphic param with concrete return (x:a>n;0) over srt
    • the exact reported shape (r:L a>n;at r 0) over rsrt and srt
    • two same-named-type-var lambdas in one fn (must not collide on a)
    • the mi.ilo shape: two (r:L a>n; ...) lambdas threaded through rsrt
    • same shape lifted from a non-main top-level fn
    • other single-letter names (z, k) to pin the spec rule, not a hard-coded a
    • reserved-letter n still parses as the concrete number type (the type-var fast-path doesn't over-trigger)
    • fld with type-var accumulator ((acc:a x:a>n;...))
    • nested L (L a) so the type walker handles depth
  • examples/inline-lambda-typevar.ilo so the examples harness exercises the shape on every engine and agents get an in-context working sample.

Test plan

  • cargo test --release --features cranelift --test regression_inline_lambda_typevar — 12/12 pass
  • cargo test --release --features cranelift --test examples_engines — passes
  • cargo test --release --features cranelift (full suite) — all green
  • cargo fmt --check — clean
  • cargo clippy --release --features cranelift --tests -- -D warnings — clean

Follow-ups

None. The originating entry in ilo_assessment_feedback.md will be moved to the Addressed section with a link to this PR.

Nlp-engineer rerun6 reported `rsrt (r:L a>n;at r 0) rows` failed with
cascading ILO-T002 / ILO-P001 against v0.11.5 — the lifter looked like
it was treating type-var `a` as a top-level fn name. Cannot reproduce
on f6b3271: every variant of the reported shape now parses, verifies,
and runs identically on tree, VM, and Cranelift. Most likely the bug
was closed in passing by one of the v0.11.4 to v0.11.5 parser/lambda
fixes (hof-error-parity, bare-bang-nil, listlit-fnref-greedy).

Pins 12 cross-engine cases of the shape so it can't regress silently:
identity `(x:a>a;x)`, polymorphic param with concrete return, the exact
`(r:L a>n;at r 0)` from the report, two same-named-type-var lambdas in
one fn, lifted from a non-main top-level fn, other single-letter names
(z, k), reserved-letter `n` to confirm the type-var fast-path doesn't
over-trigger, fld accumulator with type-var, nested `L (L a)`.

Adds examples/inline-lambda-typevar.ilo so the examples harness exercises
the shape on every engine and gives agents an in-context learning sample.
@danieljohnmorris danieljohnmorris merged commit 4a22e64 into main May 17, 2026
4 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/lambda-typevar-scope branch May 17, 2026 00:21
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

danieljohnmorris added a commit that referenced this pull request May 17, 2026
fifteen fixes since 0.11.5, all from rerun5/rerun6 personas plus standing asks: ListView foundation (#334), window-text-perf reshape via ListView (#336), inner-flt predicate inlining (#340), double-minus trap ILO-P021 (#331), bare-ident bang silent-nil regression (#324), Cranelift JIT span plumbing (#335), bool-prefix ternary (#330), wh prefix-cond reparse (#332), --run-engine auto-pick main (#329), subcommand helper hyphens+non-ident (#328), runtime error spans (#335), persona-diagnostic batch 3 (#327), rgxall1+ct (#333), single-line body diagnostic (#322 carry), lambda type-var defensive test (#326), N-deep prefix arity error (#339), prefix-minus span column drift (#338), doc-sync (#337).
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