(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)