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:
Yogthos 2026-06-24 09:13:14 -04:00
parent 53b1c79d99
commit 6d56982abe
7 changed files with 31 additions and 12 deletions

View file

@ -303,7 +303,7 @@
{:suite "reader" :expr "(integer? (read-string \"7\"))" :expected "true"}
{:suite "reader" :expr "(= :foo (read-string \":foo\"))" :expected "true"}
{:suite "reader" :expr "(= :a/b (read-string \":a/b\"))" :expected "true"}
{:suite "reader" :expr "(= :foo (read-string \"::foo\"))" :expected "true"}
{:suite "reader" :expr "(= [true \"foo\"] [(some? (namespace (read-string \"::foo\"))) (name (read-string \"::foo\"))])" :expected "true"}
{:suite "reader" :expr "(= (quote sym) (read-string \"sym\"))" :expected "true"}
{:suite "reader" :expr "(= (quote ns/sym) (read-string \"ns/sym\"))" :expected "true"}
{:suite "reader" :expr "(nil? (read-string \"nil\"))" :expected "true"}