ocaml: phase 1+3 record type declarations (+3 tests, 447 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s

type r = { x : int; mutable y : string } parses to
(:type-def-record NAME PARAMS FIELDS) with FIELDS each (NAME) or
(:mutable NAME). Parser dispatches on { after = to parse field list.
Field-type sources are skipped (HM registration TBD). Runtime no-op
since records already work as dynamic dicts.
This commit is contained in:
2026-05-08 18:26:34 +00:00
parent f070bddb0e
commit 66da0e5b84
4 changed files with 104 additions and 36 deletions

View File

@@ -780,6 +780,7 @@
(set! env (ocaml-env-extend env mname mod-val))
(set! result (merge result (dict mname mod-val))))))))
((= tag "type-def") nil)
((= tag "type-def-record") nil)
((= tag "exception-def") nil)
((= tag "module-type-def") nil)
((= tag "open")
@@ -962,6 +963,10 @@
;; exception E [of T] — purely declarative; raise+match
;; already work on tagged ctor values.
nil)
((= tag "type-def-record")
;; type r = { x : T; y : T } — runtime no-op; records
;; are already dynamic dicts.
nil)
((= tag "module-type-def")
;; module type S = sig … end — no-op at runtime.
nil)