ocaml: phase 4 'let open M in body' local opens (+3 tests, 478 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s

Parser detects 'let open' as a separate let-form, parses M as a path
(Ctor(.Ctor)*) directly via inline AST construction (no source slicing
since cur-pos is only available in ocaml-parse-program), and emits
(:let-open PATH BODY).

Eval resolves the path to a module dict and merges its bindings into
the env for body evaluation. Now:

  let open List in map (fun x -> x * 2) [1;2;3]   = [2;4;6]
  let open Option in map (fun x -> x + 1) (Some 5) = Some 6
This commit is contained in:
2026-05-08 21:33:14 +00:00
parent 0530120bc7
commit 6dc535dde3
4 changed files with 59 additions and 1 deletions

View File

@@ -407,6 +407,12 @@ _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 4 — `let open M in body` local opens (+3 tests, 478
total). Parser detects `let open` as a separate let-form, parses M
as a path (Ctor(.Ctor)*), and emits `(:let-open PATH BODY)`. Eval
resolves the path to a module dict and merges its bindings into the
env for body evaluation. `let open List in map (fun x -> x * 2)
[1;2;3]` → `[2;4;6]`.
- 2026-05-08 Phase 4 — `:def-mut` / `:def-rec-mut` inside module
bodies (+2 tests, 475 total). `ocaml-eval-module` now handles
multi-binding `let .. and ..` decls. `module M = struct let rec a n =