ocaml: phase 5 HM let-mut / let-rec-mut (+3 tests, 442 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
ocaml-infer-let-mut: each rhs inferred in parent env, generalized sequentially before adding to body env. ocaml-infer-let-rec-mut: pre-bind all names with fresh tvs; infer each rhs against the joint env, unify each with its tv, then generalize all and infer body. Mutual recursion now type-checks: 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) in even : Int -> Bool
This commit is contained in:
@@ -1084,6 +1084,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 3708)
|
||||
(eval "(ocaml-run \"Bytes.concat \\\"-\\\" [\\\"a\\\";\\\"b\\\";\\\"c\\\"]\")")
|
||||
|
||||
;; ── HM let-mut / let-rec-mut ──────────────────────────────────
|
||||
(epoch 3800)
|
||||
(eval "(ocaml-type-of \"let x = 1 and y = 2 in x + y\")")
|
||||
(epoch 3801)
|
||||
(eval "(ocaml-type-of \"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) in even\")")
|
||||
(epoch 3802)
|
||||
(eval "(ocaml-type-of \"let f x = x + 1 and g x = x * 2 in f 1 + g 2\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1715,6 +1723,11 @@ check 3706 "Result.fold Ok" '50'
|
||||
check 3707 "Bytes.length" '5'
|
||||
check 3708 "Bytes.concat" '"a-b-c"'
|
||||
|
||||
# ── HM let-mut / let-rec-mut ───────────────────────────────────
|
||||
check 3800 "let-mut x+y : Int" '"Int"'
|
||||
check 3801 "let-rec-mut even" '"Int -> Bool"'
|
||||
check 3802 "let-mut f and g" '"Int"'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user