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

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:
2026-05-08 19:19:17 +00:00
parent fff8fe2dc8
commit 8c7ad62b44
3 changed files with 93 additions and 0 deletions

View File

@@ -407,6 +407,11 @@ _Newest first._
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
'a tree`) with insert + in-order traversal. Tests parametric ADT,
recursive match, List.append, List.fold_left.
- 2026-05-08 Phase 5 — HM for top-level `let..and..` decls (+3
tests, 454 total). `ocaml-type-of-program` now handles `:def-mut`
(sequential generalization) and `:def-rec-mut` (mutual recursion
with shared tvs) decls. Mutual `even`/`odd` and `map`/`length`
type-check at top level.
- 2026-05-08 Phase 5.1 — memo_fib.ml baseline (16/16 pass). Memoized
fibonacci using `Hashtbl.find_opt` + `Hashtbl.add`. fib(25) = 75025.
Demonstrates mutable dict semantics through the OCaml stdlib API.