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
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:
@@ -1098,6 +1098,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 3901)
|
||||
(eval "(ocaml-run-program \"let x = 10 ;; let _ = x ;; x * 2\")")
|
||||
|
||||
;; ── Record type declarations ──────────────────────────────────
|
||||
(epoch 4000)
|
||||
(eval "(ocaml-parse-program \"type point = { x : int; y : int }\")")
|
||||
(epoch 4001)
|
||||
(eval "(ocaml-parse-program \"type r = { mutable x : int; y : string }\")")
|
||||
(epoch 4002)
|
||||
(eval "(ocaml-run-program \"type point = { x : int; y : int };; let p = { x = 3; y = 4 };; p.x + p.y\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1738,6 +1746,11 @@ check 3802 "let-mut f and g" '"Int"'
|
||||
check 3900 "let _ = 1+2;; 42" '42'
|
||||
check 3901 "two top-level lets, _" '20'
|
||||
|
||||
# ── Record type declarations ──────────────────────────────────
|
||||
check 4000 "record type decl" '("type-def-record" "point" () (("x") ("y")))'
|
||||
check 4001 "mutable field decl" '("mutable" "x")'
|
||||
check 4002 "record decl + use" '7'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user