(type record) returns its class-name string, not a symbol

(type r) returned a symbol user.TyR, so (= (symbol (str (type r))) (type r))
was true; the JVM's type is a Class (not a Symbol) so it's false. jolt models
classes as strings, so a record's type is now its ns-qualified class-name
string — equal to (class r), as on the JVM where type and class coincide for a
record. The symbol-keyed print-method defmethods already fall through to the
default record printing, so they're unaffected. Closes type-of-record.
This commit is contained in:
Yogthos 2026-06-22 00:05:08 -04:00
parent ab96650fbb
commit 0e4ccc97e0
3 changed files with 9 additions and 8 deletions

View file

@ -79,9 +79,10 @@
(override (if (jolt-nil? m) jolt-nil (jolt-get m ty-kw-type jolt-nil))))
(cond
((not (jolt-nil? override)) override) ; :type meta wins
;; record -> ns.Name symbol. No-ns sentinel is #f (not jolt-nil) so it = the
;; overlay's (symbol (str t)) — jolt= compares the ns field with equal?.
((jrec? x) (jolt-symbol #f (jrec-tag x)))
;; record -> its ns-qualified class-name STRING (= (class x)). jolt models
;; classes as strings, so (symbol (str (type r))) is NOT (type r) — as on the
;; JVM where type is a Class, not a Symbol.
((jrec? x) (jrec-tag x))
((jolt-nil? x) jolt-nil)
((boolean? x) ty-boolean)
((number? x) ty-number)

View file

@ -11,7 +11,7 @@
;; reset between cases so there is no leakage — same isolation a fresh process gives.
;;
;; chez --script host/chez/run-corpus.ss
;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2726)
;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2727)
;; JOLT_CORPUS_LIMIT=N every-Nth stride (fast iteration; floor drops to 0)
;; JOLT_DUMP_CRASH_LABELS=1 list crash + allowlisted labels
(import (chezscheme))
@ -87,7 +87,7 @@
;; a NEW (unlisted) divergence or a drop below the floor.
(define known-fail-labels
'("getMessage on a thrown string"
"type of record" "chunked-seq? always false"
"chunked-seq? always false"
"close on throw" "macroexpand-1"
"bean is the map" "proxy resolves nil"
"transient vector" "transient map"
@ -189,7 +189,7 @@
;; Regression floor: fail on any NEW divergence or if pass drops below the floor.
(define base-floor (let ((s (getenv "JOLT_CHEZ_ZJ_FLOOR")))
(if s (string->number s) 2726)))
(if s (string->number s) 2727)))
(define floor (if limit 0 base-floor))
(when (or (> (length diverged) 0) (< pass floor))
(printf "REGRESSION: pass ~a < floor ~a or ~a new divergence(s)\n"