Fix general gaps the hiccup suite shook out
Six correctness fixes, each a general gap (not hiccup-specific): - deftype is not a map. jolt treated every deftype instance as a map (map?/record?/seqable over its fields); in Clojure only a defrecord is map-like, a bare deftype is an opaque object. defrecord now marks its type; map?/record?/coll?/seq/empty? gate on it, while a deftype implementing a collection interface still dispatches through its methods. - cross-ns extend-protocol on an imported deftype. register-method built the type tag from the *calling* ns + bare name, so (extend-protocol P Raw …) in one ns missed a Raw value defined in another. A simple-name index resolves the bare name to the type's real tag (local ns still wins). - str vs print. str of a collection is its readable form (nested strings quoted: (str ["x"]) => ["x"]); print leaves them raw. jolt defined print as str, conflating the two. Split via a __print1 seam. - clojure.test thrown? now honors the exception hierarchy (instance?), so (thrown? IllegalArgumentException …) matches an ArityException subclass. - java.net.URI is value-equal (= and hash by string form). - clojure.walk/macroexpand-all was missing; an unresolved qualified var made the analyzer report "Unknown class walk". deftype/defrecord + print are seed sources, re-minted. hiccup 365->381 of its own suite; the rest are charset-encoding / var-meta niches.
This commit is contained in:
parent
448611a5df
commit
3d80bdc10b
12 changed files with 823 additions and 724 deletions
|
|
@ -95,10 +95,10 @@
|
|||
;; chunked-seq? is true for a vector's seq (a real chunked-seq); the overlay's
|
||||
;; always-false stub loaded over the host fn, so re-assert it.
|
||||
(def-var! "clojure.core" "chunked-seq?" na-chunked-seq?)
|
||||
;; record? is a host type check (jrec?), not the overlay's (some? (get x
|
||||
;; :jolt/deftype)) — the get-trick invokes a sorted-map's comparator on
|
||||
;; :jolt/deftype and throws. Matches the JVM (instance? IRecord).
|
||||
(def-var! "clojure.core" "record?" (lambda (x) (jrec? x)))
|
||||
;; record? is a host type check — true only for a defrecord, not a bare deftype
|
||||
;; (jrec-record?), matching the JVM (instance? IRecord). The overlay's
|
||||
;; (some? (get x :jolt/deftype)) get-trick would invoke a sorted-map comparator.
|
||||
(def-var! "clojure.core" "record?" (lambda (x) (jrec-record? x)))
|
||||
|
||||
;; read / read+string over a HOST reader jhost (java.io StringReader/PushbackReader):
|
||||
;; the overlay's IReader protocol only covers the reify map-reader, so a (read
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue