ocaml: phase 5 HM def-mut + def-rec-mut at top level (+3 tests, 454 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
ocaml-type-of-program now handles :def-mut (sequential generalize) and
:def-rec-mut (pre-bind tvs, infer rhs, unify, generalize all, infer
body — same algorithm as the inline let-rec-mut version).
Mutual top-level recursion now type-checks:
let rec even n = ... and odd n = ...;; even 10 : Bool
let rec map f xs = ... and length lst = ...;; map :
('a -> 'b) -> 'a list -> 'b list
This commit is contained in:
@@ -1116,6 +1116,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 4103)
|
||||
(eval "(ocaml-run \"let r = { x = 1; y = 2 } in r.x <- r.y * 10; r.x\")")
|
||||
|
||||
;; ── HM top-level def-mut / def-rec-mut ────────────────────────
|
||||
(epoch 4200)
|
||||
(eval "(ocaml-type-of-program \"let x = 1 and y = 2;; x + y\")")
|
||||
(epoch 4201)
|
||||
(eval "(ocaml-type-of-program \"let rec even n = if n = 0 then true else odd (n - 1) and odd n = if n = 0 then false else even (n - 1);; even 10\")")
|
||||
(epoch 4202)
|
||||
(eval "(ocaml-type-of-program \"let rec map f xs = match xs with | [] -> [] | h :: t -> f h :: map f t and length lst = match lst with | [] -> 0 | _ :: t -> 1 + length t;; map\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1767,6 +1775,11 @@ check 4101 "for-loop accum r.x" '15'
|
||||
check 4102 "r.name <- str" '"Alice"'
|
||||
check 4103 "r.x <- r.y * 10" '20'
|
||||
|
||||
# ── HM top-level def-mut / def-rec-mut ─────────────────────────
|
||||
check 4200 "let-mut x+y" '"Int"'
|
||||
check 4201 "let-rec-mut even 10" '"Bool"'
|
||||
check 4202 "let-rec-mut map+length" 'list -> '
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user