diff --git a/host/chez/host-static.ss b/host/chez/host-static.ss index 369bae5..2e6deeb 100644 --- a/host/chez/host-static.ss +++ b/host/chez/host-static.ss @@ -94,8 +94,18 @@ (define (host-new class . args) (let ((ctor (lookup-class class-ctors-tbl class))) - (if ctor (apply ctor args) - (error #f (string-append "No constructor for class " class))))) + (cond + (ctor (apply ctor args)) + ;; deftype/defrecord (jolt-499t): the type name is bound as a VAR (the + ;; make-deftype-ctor closure) in its defining ns, not a registered host class. + ;; Resolve it in the current ns / clojure.core and invoke it — so (P. args) + ;; works the same as the ->P factory. + (else + (let ((cell (or (var-cell-lookup (chez-current-ns) class) + (var-cell-lookup "clojure.core" class)))) + (if (and cell (var-cell-defined? cell) (procedure? (var-cell-root cell))) + (apply (var-cell-root cell) args) + (error #f (string-append "No constructor for class " class)))))))) ;; ---- coercion helpers ------------------------------------------------------- (define (->num x) (exact->inexact x)) diff --git a/test/chez/run-corpus-prelude.janet b/test/chez/run-corpus-prelude.janet index ce718c6..2fc3070 100644 --- a/test/chez/run-corpus-prelude.janet +++ b/test/chez/run-corpus-prelude.janet @@ -321,9 +321,9 @@ # match the JVM's async raciness and are allowlisted) -> 2557. # jolt-cf1q.7 parity batches (hash/rseq/cat/transient-as-fn + ns runtime fns + # runtime-require alias registration) -> 2590; arrays + reader-features/ -# macroexpand/reader-conditional/re-matcher -> 2629. +# macroexpand/reader-conditional/re-matcher -> 2629; delay/force/realized? -> 2641. # Strided runs scale down. -(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2629"))) +(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2641"))) (def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor)) (when (or (> (length diverged) 0) (< pass floor)) (printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged))) diff --git a/test/chez/run-corpus-zero-janet.janet b/test/chez/run-corpus-zero-janet.janet index c0dd21d..80fa538 100644 --- a/test/chez/run-corpus-zero-janet.janet +++ b/test/chez/run-corpus-zero-janet.janet @@ -215,8 +215,9 @@ # are allowlisted) -> 2567. jolt-cf1q.7 parity batches (hash/rseq/cat/transient-as-fn # + ns runtime fns) -> 2600; arrays -> 2631; reader-features/reader-conditional/ # re-matcher/macroexpand -> 2642; runtime-defmacro cases via top-level eval of -# ACTUAL (matching certify.clj's eval-isolated) -> 2673; delay/force/realized? -> 2685. -(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2685"))) +# ACTUAL (matching certify.clj's eval-isolated) -> 2673; delay/force/realized? -> +# 2685; deftype (P. args) constructor via host-new var fallback -> 2688. +(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2688"))) (def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor)) (when (or (> (length diverged) 0) (< pass floor)) (printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged)))