ocaml: phase 4 'let f (a, b) = body' tuple-param on inner-let (+3 tests, 556 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Mirrors iteration 101's parse-fun change inside parse-let's
parse-one!:
- same '(IDENT, ...)' detection on collect-params
- same __pat_N synth name for the function param
- same innermost-first match-wrapping
Difference: for inner-let the wrapping is applied to the rhs of the
let-binding (which is the function value), not directly to a fun
body.
let f (a, b) = a + b in f (3, 7) = 10
let g x (a, b) = x + a + b in g 1 (2, 3) = 6
let h (a, b) (c, d) = a * b + c * d
in h (1, 2) (3, 4) = 14
This commit is contained in:
@@ -1380,6 +1380,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 5123)
|
||||
(eval "(ocaml-run \"(fun a (b, c) d -> a + b + c + d) 1 (2, 3) 4\")")
|
||||
|
||||
;; ── let f (a, b) = body — tuple param on inner-let ────────────
|
||||
(epoch 5130)
|
||||
(eval "(ocaml-run \"let f (a, b) = a + b in f (3, 7)\")")
|
||||
(epoch 5131)
|
||||
(eval "(ocaml-run \"let g x (a, b) = x + a + b in g 1 (2, 3)\")")
|
||||
(epoch 5132)
|
||||
(eval "(ocaml-run \"let h (a, b) (c, d) = a * b + c * d in h (1, 2) (3, 4)\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 360 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -2193,6 +2201,11 @@ check 5121 "List.map fun (a, b)" '(2 12 30)'
|
||||
check 5122 "List.map fun (k, _)" '("a" "b")'
|
||||
check 5123 "fun a (b, c) d mixed" '10'
|
||||
|
||||
# ── let f (a, b) = body — let with tuple param ──────────────────
|
||||
check 5130 "let f (a, b) = a + b" '10'
|
||||
check 5131 "let g x (a, b) mixed" '6'
|
||||
check 5132 "let h (a, b) (c, d) curried" '14'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user