Goal
Flip the inferred-return-typed-lambda corpus to green and pin the new behavior with positive + negative tests.
Intelligence Reconnaissance
Queries (2026-05-31): scripts/intel-query.sh status (graph available); failing files identified by the ori test tests/ run that surfaced E1005/E1017.
- [ori] Failing files:
tests/spec/expressions/lambdas.ori,tests/spec/inference/{generics,unification}.ori,tests/spec/capabilities/providing.ori— all use(x: T) -> bodyand fail to parse today. - [ori]
#compile_failnegative-pin mechanism perori-syntax.md §Tests;assert_eqrequiresuse std.testing { assert_eq }.
Implementation Sketch
The corpus already uses (x: T) -> body; once section-02 lands the parser support, those files parse. Add explicit pins so a future revert is caught: a positive pin equating (x: int) -> x * 2 with the explicit-return form, and a #compile_fail negative pin for the bare--> Type form asserting E2005 (the type name int is parsed as the body expression and fails type inference as a value — per proposal Errata 2026-05-31).
Implementation Items
- Run
cargo st(orori test tests/) and confirm the four named files parse + pass. - Add a positive pin:
(x: int) -> x * 2and(x: int) -> int = x * 2produce identical results (inferred == explicit). - Add a negative pin:
#compile_fail(code: "E2005")on bare(x: int) -> int(delivered astests/spec/expressions/typed_lambda_bare_return_type_e2005.ori). Two non-obvious requirements: (1) the lambda MUST be CALLED — an unused bare lambda defers body inference and type-checks clean, sof(x: 5)is required to force E2005; (2) the function MUST be test-marked (tests _floating form) — a#compile_failon a plain@fnis a ghost test (never collected intomodule.tests, assertion never fires). NOT a parse diagnostic. - Confirm
use std.testing { assert_eq }import present in any new.oritest file. - Verify debug + release parity (
cargo stboth profiles).
Spec References
- Proposal §Prior Art / §Design (the worked-cases table is the test oracle).
- Existing corpus:
tests/spec/expressions/lambdas.ori,tests/spec/inference/{generics,unification}.ori,tests/spec/capabilities/providing.ori.
Tests
- Positive pin: inferred-return == explicit-return result.
- Negative pin: bare
-> Type#compile_failassertingE2005(type-name-as-value at typeck, not a parse diagnostic). - Corpus gate: the four named files green; no lambda-return-inference failures in
cargo st.