ocaml: phase 1 type annotations on let / (e : T) (+4 tests, 473 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
let NAME [PARAMS] : T = expr and (expr : T) parse and skip the type source. Runtime no-op since SX is dynamic. Works in inline let, top-level let, and parenthesised expressions: let x : int = 5 ;; x + 1 -> 6 let f (x : int) : int = x + 1 in f 41 -> 42 (5 : int) -> 5 ((1 + 2) : int) * 3 -> 9
This commit is contained in:
@@ -1162,6 +1162,16 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 4601)
|
||||
(eval "(ocaml-run-program \"type t = int;; 42\")")
|
||||
|
||||
;; ── Type annotations: let x : T = e and (e : T) ──────────────
|
||||
(epoch 4700)
|
||||
(eval "(ocaml-run-program \"let x : int = 5;; x + 1\")")
|
||||
(epoch 4701)
|
||||
(eval "(ocaml-run \"let f (x : int) : int = x + 1 in f 41\")")
|
||||
(epoch 4702)
|
||||
(eval "(ocaml-run \"(5 : int)\")")
|
||||
(epoch 4703)
|
||||
(eval "(ocaml-run \"((1 + 2) : int) * 3\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1841,6 +1851,12 @@ check 4502 "try when fall through" '1005'
|
||||
check 4600 "type t = int parses" '("type-alias" "t" ())'
|
||||
check 4601 "type alias decl + use" '42'
|
||||
|
||||
# ── Type annotations ───────────────────────────────────────────
|
||||
check 4700 "let x : int = 5" '6'
|
||||
check 4701 "let f (x : int) : int" '42'
|
||||
check 4702 "(5 : int)" '5'
|
||||
check 4703 "((1+2) : int) * 3" '9'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user