Commit 53150ee
feat(parser): fn(params) => expr anonymous-function expressions (#135)
#135 slice 1. The grammar only accepted `|x| body` lambdas; the stdlib
actually uses `fn(x) => e` (e.g. `map(fn(x) => Some(x), list)` in
option.affine), which failed to parse.
Adds two productions next to the pipe-lambda, lowering to the same
ExprLambda:
fn(params) => expr
fn(params) -> RetTy { block }
reusing `lambda_param` (so untyped, typed, and @-quantity params all
work). `FN` is unambiguous in expression position (no other expression
form starts with `fn`) — verified: identical menhir conflict counts
(26 s/r states, 5 r/r states, 76/35 resolved) before and after, i.e.
zero new grammar conflicts.
Effect: option.affine advances past the lambda-expression wall
(parse error 180 → 238; 238 is a distinct later-slice defect). Adds
three focused regression tests. Full suite green (223 tests).
Advances #135 (does not close it — remaining per-file defects tracked
in docs/history/STDLIB-AOT-TRIAGE.md). Refs #128, #135.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f879862 commit 53150ee
2 files changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
729 | 739 | | |
730 | 740 | | |
731 | 741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3298 | 3298 | | |
3299 | 3299 | | |
3300 | 3300 | | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
3301 | 3321 | | |
3302 | 3322 | | |
3303 | 3323 | | |
| |||
3345 | 3365 | | |
3346 | 3366 | | |
3347 | 3367 | | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
3348 | 3371 | | |
3349 | 3372 | | |
3350 | 3373 | | |
| |||
0 commit comments