ocaml: phase 5 HM let-rec + cons / append op types (+6 tests, 357 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s

ocaml-infer-let-rec pre-binds the function name to a fresh tv before
inferring rhs (which may recursively call the name), unifies the
inferred rhs type with the tv, generalizes, then infers body.

Builtin env types :: : 'a -> 'a list -> 'a list and @ : 'a list ->
'a list -> 'a list — needed because :op compiles to (:app (:app (:var
OP) L) R) and previously these var lookups failed.

Examples now infer:
  let rec fact n = if ... in fact : Int -> Int
  let rec len lst = ... in len    : 'a list -> Int
  let rec map f xs = ... in map   : ('a -> 'b) -> 'a list -> 'b list
  1 :: [2; 3]                      : Int list
  let rec sum lst = ... in sum [1;2;3] : Int

Scoreboard refreshed: 358/358 across 14 suites.
This commit is contained in:
2026-05-08 13:08:51 +00:00
parent 81247eb6ea
commit 5bc7895ce0
5 changed files with 86 additions and 16 deletions

View File

@@ -1,20 +1,20 @@
# OCaml-on-SX scoreboard
320 / 320 tests passing.
358 / 358 tests passing.
| Suite | Pass | Fail |
|---|---:|---:|
| eval-core | 48 | 0 |
| eval-core | 50 | 0 |
| let-and | 3 | 0 |
| misc | 52 | 0 |
| parser | 87 | 0 |
| misc | 61 | 0 |
| parser | 93 | 0 |
| phase1-params | 2 | 0 |
| phase2-exn | 8 | 0 |
| phase2-function | 3 | 0 |
| phase2-loops | 4 | 0 |
| phase2-refs | 6 | 0 |
| phase3-adt | 19 | 0 |
| phase3-adt | 24 | 0 |
| phase4-modules | 12 | 0 |
| phase5-hm | 19 | 0 |
| phase6-stdlib | 39 | 0 |
| phase5-hm | 31 | 0 |
| phase6-stdlib | 43 | 0 |
| tokenize | 18 | 0 |