From fb7338c0222614f645a490fe42c581c59baea251 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 5 Apr 2026 12:20:23 +0000 Subject: [PATCH] Fix last test: unify scope stacks between test runner and evaluator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run_tests.ml had a local _scope_stacks hash table, separate from Sx_primitives._scope_stacks used by the CEK evaluator. SX-level scope-push!/scope-peek used the local table, but step-sf-context's scope_peek used the global one. Aser's provide handler pushed to one table, context read from the other — always got nil. Fix: alias run_tests.ml's _scope_stacks to Sx_primitives._scope_stacks. 2768/2768 OCaml tests pass. Zero failures. Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/run_tests.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hosts/ocaml/bin/run_tests.ml b/hosts/ocaml/bin/run_tests.ml index 9d90a6bd..16cbca54 100644 --- a/hosts/ocaml/bin/run_tests.ml +++ b/hosts/ocaml/bin/run_tests.ml @@ -332,9 +332,10 @@ let make_test_env () = let result = eval_expr (List [Symbol "aser"; expr; Env e]) (Env e) in (match result with SxExpr s -> String s | String s -> String s | _ -> String (Sx_runtime.value_to_str result)) | _ -> String ""); - (* Scope primitives — use a local scope stacks table. - Must match the same pattern as sx_server.ml's _scope_stacks. *) - let _scope_stacks : (string, Sx_types.value list) Hashtbl.t = Hashtbl.create 8 in + (* Scope primitives — share the same scope stacks as sx_primitives.ml + so that CEK evaluator's scope_push/scope_peek and SX-level scope-push!/scope-peek + operate on the same table. *) + let _scope_stacks = Sx_primitives._scope_stacks in bind "scope-push!" (fun args -> match args with | [String name; value] -> @@ -1382,6 +1383,7 @@ let run_spec_tests env test_files = | Some (Lambda _ as fn) -> Sx_ref.cek_call fn (List args) | _ -> String ""))); + let files = if test_files = [] then begin (* Spec tests (core language — always run) *) let spec_entries = Sys.readdir spec_tests_dir in