ocaml: phase 1+5.1 type aliases + poly_stack baseline (+3 tests, 469 / 19 baseline)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s

Parser: in parse-decl-type, dispatch on the post-= token:
  '|' or Ctor   -> sum type
  '{'           -> record type
  otherwise     -> type alias (skip to boundary)
AST (:type-alias NAME PARAMS) with body discarded. Runtime no-op since
SX has no nominal types.

poly_stack.ml baseline exercises:
  module type ELEMENT = sig type t val show : t -> string end
  module IntElem = struct type t = int let show x = ... end
  module Make (E : ELEMENT) = struct ... use E.show ... end
  module IntStack = Make(IntElem)

Demonstrates the substrate handles signature decls + abstract types +
functor parameter with sig constraint.
This commit is contained in:
2026-05-08 20:49:26 +00:00
parent c7d8b7dd62
commit ce75bd6848
6 changed files with 72 additions and 0 deletions

View File

@@ -1156,6 +1156,12 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 4502)
(eval "(ocaml-run \"try raise (E 5) with | E n when n > 100 -> n | E n -> n + 1000\")")
;; ── type aliases ──────────────────────────────────────────────
(epoch 4600)
(eval "(ocaml-parse-program \"type t = int\")")
(epoch 4601)
(eval "(ocaml-run-program \"type t = int;; 42\")")
EPOCHS
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1831,6 +1837,10 @@ check 4500 "try when guard fires" '5'
check 4501 "try when guard skips" '0'
check 4502 "try when fall through" '1005'
# ── type aliases ───────────────────────────────────────────────
check 4600 "type t = int parses" '("type-alias" "t" ())'
check 4601 "type alias decl + use" '42'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"