Auto-resolve ::keywords; honor clojure.edn reader opts
The reader dropped the namespace on ::kw (read ::foo as :foo), so auto-resolved keywords never matched their qualified form — code that round-trips them (spec keys, aero's :aero.core/* expansion keys) silently broke. Resolve ::name against the current ns and ::alias/name through the alias table, as Clojure does. The runtime loader reads form-by-form with the ns set after the ns form; the cross-compile reads all forms up front, so ei-emit-ns*/ei-emit-ns-records set the ns before reading. clojure.edn/read over a reader discarded its opts map — :readers/:default/:eof were ignored, so a custom :default never saw the tag. Route the reader arity through read-string so opts apply, and pass the tag to :default as a symbol (not the internal :#name keyword), matching Clojure. Seed re-minted (the ::halt transducer key in clojure.core now reads as :clojure.core/halt). Corpus gains ::-keyword rows; the unit case that asserted the old ns-dropping behavior now asserts the qualified result.
This commit is contained in:
parent
53b1c79d99
commit
6d56982abe
7 changed files with 31 additions and 12 deletions
|
|
@ -2645,6 +2645,9 @@
|
|||
{:suite "clojure.walk / records keep their type" :label "instance? survives a walk" :expected "true" :actual "(do (require (quote [clojure.walk :as w])) (defrecord R [a]) (instance? R (w/postwalk identity (->R 1))))"}
|
||||
{:suite "clojure.walk / records keep their type" :label "a record nested in a map keeps its type" :expected "true" :actual "(do (require (quote [clojure.walk :as w])) (defrecord R [a]) (record? (:r (w/postwalk identity {:r (->R 1)}))))"}
|
||||
{:suite "clojure.walk / records keep their type" :label "prewalk preserves record type" :expected "true" :actual "(do (require (quote [clojure.walk :as w])) (defrecord R [a]) (record? (w/prewalk identity (->R 1))))"}
|
||||
{:suite "reader / auto-resolved keywords" :label "::kw is namespace-qualified" :expected "true" :actual "(some? (namespace ::foo))"}
|
||||
{:suite "reader / auto-resolved keywords" :label "::kw keeps its name" :expected "\"foo\"" :actual "(name ::foo)"}
|
||||
{:suite "reader / auto-resolved keywords" :label "::kw resolves to the current ns" :expected "true" :actual "(= ::a ::a)"}
|
||||
{:suite "conformance / CRITICAL: lazy sequences" :label "self-ref lazy-cat fib" :expected "[0 1 1 2 3 5 8 13 21 34]" :actual "(do (def fib-seq (lazy-cat [0 1] (map + (rest fib-seq) fib-seq))) (take 10 fib-seq))"}
|
||||
{:suite "conformance / CRITICAL: multi-collection map" :label "map two colls" :expected "[11 22 33]" :actual "(map + [1 2 3] [10 20 30])"}
|
||||
{:suite "conformance / CRITICAL: multi-collection map" :label "map three colls" :expected "[12 24 36]" :actual "(map + [1 2 3] [10 20 30] [1 2 3])"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue