20%

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) -> body and fail to parse today.
  • [ori] #compile_fail negative-pin mechanism per ori-syntax.md §Tests; assert_eq requires use 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 (or ori test tests/) and confirm the four named files parse + pass.
  • Add a positive pin: (x: int) -> x * 2 and (x: int) -> int = x * 2 produce identical results (inferred == explicit).
  • Add a negative pin: #compile_fail(code: "E2005") on bare (x: int) -> int (delivered as tests/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, so f(x: 5) is required to force E2005; (2) the function MUST be test-marked (tests _ floating form) — a #compile_fail on a plain @fn is a ghost test (never collected into module.tests, assertion never fires). NOT a parse diagnostic.
  • Confirm use std.testing { assert_eq } import present in any new .ori test file.
  • Verify debug + release parity (cargo st both 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_fail asserting E2005 (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.