From 67ae88b87fd78fd7c0b94fb7086eba074ab296e7 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 5 Apr 2026 19:49:37 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20last=202=20foreign-type-checking=20tests:?= =?UTF-8?q?=20ListRef=20match=20+=20#t=E2=86=92true?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - run_tests.ml: foreign-check-args binding now matches ListRef (from the list primitive) in addition to List - test-foreign.sx: replace #t with true in guard clauses — SX parser treats #t as a symbol, not a boolean 2800/2800 tests, zero failures. Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/run_tests.ml | 7 ++++++- spec/tests/test-foreign.sx | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hosts/ocaml/bin/run_tests.ml b/hosts/ocaml/bin/run_tests.ml index 13b83e47..0462d382 100644 --- a/hosts/ocaml/bin/run_tests.ml +++ b/hosts/ocaml/bin/run_tests.ml @@ -636,7 +636,12 @@ let make_test_env () = bind "foreign-names" (fun _args -> Sx_ref.foreign_names ()); bind "foreign-register!" (fun args -> match args with [String n; spec] -> Sx_ref.foreign_register_b (String n) spec | _ -> Nil); bind "foreign-resolve-binding" (fun args -> match args with [String s] -> Sx_ref.foreign_resolve_binding (String s) | _ -> Nil); - bind "foreign-check-args" (fun args -> match args with [String n; List p; List a] -> Sx_ref.foreign_check_args (String n) (List p) (List a) | _ -> Nil); + bind "foreign-check-args" (fun args -> + let to_list = function List l -> List l | ListRef r -> List !r | v -> v in + match args with + | [String n; (List _ | ListRef _ as p); (List _ | ListRef _ as a)] -> + Sx_ref.foreign_check_args (String n) (to_list p) (to_list a) + | _ -> Nil); bind "foreign-build-lambda" (fun args -> match args with [spec] -> Sx_ref.foreign_build_lambda spec | _ -> Nil); (* Initialize CEK call forward ref — needed by with-capabilities and foreign-dispatch *) diff --git a/spec/tests/test-foreign.sx b/spec/tests/test-foreign.sx index d1b666d6..7b10ebec 100644 --- a/spec/tests/test-foreign.sx +++ b/spec/tests/test-foreign.sx @@ -165,7 +165,7 @@ (deftest "foreign-check-args rejects wrong type" (let - ((err (guard (e (#t (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"}) (list "not-a-number")) nil))) + ((err (guard (e (true (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"}) (list "not-a-number")) nil))) (assert (contains? err "expected number")))) (deftest "foreign-check-args accepts any type" @@ -175,5 +175,5 @@ (deftest "foreign-check-args rejects too few args" (let - ((err (guard (e (#t (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"} {:type "number" :name "y"}) (list 1)) nil))) + ((err (guard (e (true (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"} {:type "number" :name "y"}) (list 1)) nil))) (assert (contains? err "expected 2 args"))))) \ No newline at end of file