From 3412563a79f4b49a371437834d7f2b34e30962f3 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 24 Jun 2026 11:03:33 -0400 Subject: [PATCH] Tagged literals are value-equal (tagged-literal t f) compared by identity, so two equal tagged literals were not = and didn't dedup as map keys / set members; JVM's TaggedLiteral is value-equal. Add a register-eq-arm! for jtagged (tag + recursive form); hash is already structural. Fixes an infinite loop in any fixpoint that dedups structures containing tagged literals (e.g. aero's #ref expansion). --- host/chez/natives-misc.ss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/host/chez/natives-misc.ss b/host/chez/natives-misc.ss index 1768ab6..ff66458 100644 --- a/host/chez/natives-misc.ss +++ b/host/chez/natives-misc.ss @@ -82,6 +82,13 @@ (else d)))) (define (jtagged-pr t) (string-append "#" (jolt-pr-str (jtagged-tag t)) " " (jolt-pr-readable (jtagged-form t)))) (register-pr-arm! jtagged? jtagged-pr) +;; two tagged literals are = iff same tag and (recursively) = form, like the JVM's +;; TaggedLiteral — so they work as map keys / set members. (jolt-hash already +;; hashes the fields structurally, so eq/hash stay consistent.) +(register-eq-arm! (lambda (a b) (or (jtagged? a) (jtagged? b))) + (lambda (a b) (and (jtagged? a) (jtagged? b) + (jolt=2 (jtagged-tag a) (jtagged-tag b)) + (jolt=2 (jtagged-form a) (jtagged-form b))))) (def-var! "clojure.core" "tagged-literal" jolt-tagged-literal) ;; tagged-literal? is OVERLAY (reads :jolt/type) — asserted in post-prelude.ss.