ocaml: phase 3 exception declarations (+4 tests, 304 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s

exception NAME [of TYPE] parses to (:exception-def NAME [ARG-SRC]).
Runtime is a no-op: raise/match already work on tagged ctor values, so
'exception E of int;; try raise (E 5) with | E n -> n' end-to-end with
zero new eval logic.
This commit is contained in:
2026-05-08 12:37:58 +00:00
parent d8f6250962
commit bc557a5ad2
4 changed files with 62 additions and 2 deletions

View File

@@ -633,6 +633,7 @@
(set! env (ocaml-env-extend env mname mod-val))
(set! result (merge result (dict mname mod-val))))))))
((= tag "type-def") nil)
((= tag "exception-def") nil)
((= tag "open")
(let ((mod-val (ocaml-resolve-module-path (nth decl 1) env)))
(cond
@@ -809,6 +810,10 @@
;; are dispatched by tag at eval/match time. Phase 5
;; HM extensions will register ctor types here.
nil)
((= tag "exception-def")
;; exception E [of T] — purely declarative; raise+match
;; already work on tagged ctor values.
nil)
((or (= tag "open") (= tag "include"))
;; open M / include M — bring M's bindings into scope.
(let ((mod-val (ocaml-resolve-module-path (nth decl 1) env)))