fd subsystem: instance? name-boundary + ~ reads as clojure.core/unquote
Two general fixes that clear core.logic's finite-domain -difference, safefd, and the defne quoted-list patterns (form->ast), taking the suite to 532/5/0. - instance? on a deftype matched a simple type name against the qualified tag by raw string suffix, so "a.b.MultiIntervalFD" tested true for IntervalFD. The suffix must land on a "." boundary. core.logic's fd dispatches on (interval? x) = (instance? IntervalFD x), and a MultiIntervalFD wrongly counted as an interval, so -difference/safefd computed the wrong set. - the reader reads ~ / ~@ as clojure.core/unquote(-splicing), like the JVM reader, instead of a bare unquote. Code that inspects quoted pattern/template data — core.logic's defne checks (= f 'clojure.core/unquote) — now sees the symbol it expects, so '(fn ~args . ~body) patterns compile. hc-head-is? accepts the qualified head in syntax-quote lowering; the value-preserving change leaves the minted seed byte-identical. corpus.edn: 2 JVM-certified unquote rows. unit.edn: two reader rows updated to the qualified unquote. make test + shakesmoke green, 0 new divergences, self-host holds.
This commit is contained in:
parent
42c163bacb
commit
f46772d576
5 changed files with 22 additions and 7 deletions
|
|
@ -298,10 +298,15 @@
|
|||
;; Any seq counts, not just a proper list: a macro that builds the template with
|
||||
;; map/for (e.g. deftype's rewrite-set) yields a LAZY seq, and its ~unquotes must
|
||||
;; still be recognized.
|
||||
;; head symbol matches name nm, bare or clojure.core-qualified — the reader
|
||||
;; produces clojure.core/unquote(-splicing) for ~/~@ (JVM parity), and this is
|
||||
;; only used to spot those heads in syntax-quote templates.
|
||||
(define (hc-head-is? x nm)
|
||||
(and (cseq? x)
|
||||
(let ((h (seq-first x)))
|
||||
(and (symbol-t? h) (jolt-nil? (hc-sym-ns h)) (string=? (symbol-t-name h) nm)))))
|
||||
(and (symbol-t? h) (string=? (symbol-t-name h) nm)
|
||||
(let ((ns (hc-sym-ns h)))
|
||||
(or (jolt-nil? ns) (and (string? ns) (string=? ns "clojure.core"))))))))
|
||||
(define (hc-second x) (seq-first (jolt-seq (seq-more x))))
|
||||
|
||||
(define (hc-sq-symbol ctx form gsmap)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue