jolt/test/spec
Dmitri Sotnikov 8ee04eed8e
Fix record field-reorder redefine (jolt-wf4) and builtin-shadowing local names (jolt-fjb1) (#124)
* Don't direct-link a var redefined earlier in the same unit (jolt-wf4)

defrecord/deftype expands to (do (def R (make-deftype-ctor ...)) (def ->R R) ...),
so the ->R alias references R within one compiled unit. Under direct-link a var
ref embeds the cell's root as a compile-time constant, but on a redefine R's old
root is still in place when that unit compiles — the (def R new) sibling hasn't
run yet — so ->R sealed to the stale pre-redef ctor. (defrecord R [x a])
(defrecord R [a x]) (:a (->R 10 20)) read the old [x a] layout and returned 20.

Track the vars a unit (re)defines and force their later in-unit references to the
live indirect deref. The cell is registered only after its own init is emitted,
so a recursive self-reference inside the init still direct-links (it runs after
the def completes); only sibling references after the def go indirect.

* Emit Janet's `in` as a value so a user local can't shadow it (jolt-fjb1)

The back end emits `in` to deref var cells ((in cell :root)) and index
shape-recs. It emitted the bare symbol, so a user local named `in` shadowed
Janet's builtin in the surrounding scope and the generated cell-deref called the
user's value as a function — "<table> called with 2 arguments, possibly expected
1". malli's explainer binds [value in acc], so m/explain hit this on every
schema (m/validate was unaffected — its path doesn't bind `in`).

Embed `in`'s function value at the emit sites (as jolt-call/core-get already
are); a value in head position can't be shadowed. Fixes m/explain on malli
(loaded with JOLT_FEATURES=clj so its .cljc reader-conditionals resolve).

---------

Co-authored-by: Yogthos <yogthos@gmail.com>
2026-06-15 16:46:00 +00:00
..
control-flow-spec.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
core-async-spec.janet feat: core.async Phase 3 — channel transducers + dropping/sliding buffers 2026-06-05 15:40:24 -04:00
deftype-tostring-spec.janet Honor a deftype's custom Object/toString in .toString and str (jolt-rt6n) 2026-06-15 10:22:09 -04:00
destructuring-spec.janet Stage2 compile only (#12) 2026-06-09 14:20:38 -04:00
exceptions-spec.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
forms-spec.janet core: variadic bit ops, set? covers sorted sets, if rejects extra forms 2026-06-11 17:04:26 -04:00
functions-spec.janet Fix record field-reorder redefine (jolt-wf4) and builtin-shadowing local names (jolt-fjb1) (#124) 2026-06-15 16:46:00 +00:00
futures-spec.janet core: lazy realization is shared across walks (once-only effects); pmap family 2026-06-10 19:14:49 -04:00
hierarchy-spec.janet core: Stage 3 — the hierarchy system is pure Clojure (canonical port) 2026-06-10 13:19:05 -04:00
host-interop-spec.janet Dedup the two .method dot-dispatch arms into one dispatch-member (jolt-eos3) 2026-06-15 04:35:52 -04:00
inst-spec.janet core: #inst instant values + syntax-quote literal collapse (spec 2.3/2.4) 2026-06-10 12:19:23 -04:00
io-spec.janet core: cold tagged-type printing migrates to print-method defmethods 2026-06-11 18:35:21 -04:00
iseq-call-spec.janet Evaluate non-array ISeq forms (cons/concat/lazy-seq) as calls (jolt-2rx) 2026-06-15 10:27:34 -04:00
lazy-seqs-spec.janet core: lazy realization is shared across walks (once-only effects); pmap family 2026-06-10 19:14:49 -04:00
lists-spec.janet test(spec): collections contract (sequences, vectors, lists, maps, sets) 2026-06-05 00:08:37 -04:00
macros-spec.janet feat: run the real clojure.tools.logging (defmacro/syntax-quote/ns + host shims) 2026-06-13 18:50:53 -04:00
map-fastpath-spec.janet fix: map literals evaluate in source order; land the local-callee inline 2026-06-12 14:09:50 -04:00
maps-spec.janet test+docs: spec coverage for migratus-enablement fixes; list migratus 2026-06-13 17:45:05 -04:00
metadata-spec.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
missing-vars-spec.janet core: the last seven missing-portable vars — coverage gap closed (jolt-brh) 2026-06-10 17:22:28 -04:00
multimethods-spec.janet test+docs: spec coverage for migratus-enablement fixes; list migratus 2026-06-13 17:45:05 -04:00
namespaces-spec.janet core: close the compile-path gaps that broke uberscripting Selmer + config 2026-06-11 01:31:50 -04:00
nrepl-spec.janet feat(nrepl): nREPL server + client in Clojure on a Janet interop bridge 2026-06-05 21:25:23 -04:00
ns-var-spec.janet core: *ns* — the current-namespace dynamic var 2026-06-10 13:05:15 -04:00
numbers-spec.janet core: variadic bit ops, set? covers sorted sets, if rejects extra forms 2026-06-11 17:04:26 -04:00
predicates-spec.janet core: zero?/pos?/every? to 00-syntax, char? to the overlay; fix rest/next over sets and maps 2026-06-11 13:24:51 -04:00
protocols-spec.janet Protocol/interop fixes to run metosin/malli (jolt-ltwk) (#105) 2026-06-15 03:20:33 +00:00
reader-forms-spec.janet core: #inst instant values + syntax-quote literal collapse (spec 2.3/2.4) 2026-06-10 12:19:23 -04:00
reader-syntax-spec.janet core: three bug fixes — ifn?, prefer-method dispatch, reader comments in map values 2026-06-10 21:03:14 -04:00
regex-spec.janet test+docs: spec coverage for migratus-enablement fixes; list migratus 2026-06-13 17:45:05 -04:00
sequences-spec.janet core: zero?/pos?/every? to 00-syntax, char? to the overlay; fix rest/next over sets and maps 2026-06-11 13:24:51 -04:00
sets-spec.janet core: variadic bit ops, set? covers sorted sets, if rejects extra forms 2026-06-11 17:04:26 -04:00
sorted-spec.janet core: Stage 3 — sorted collections are pure Clojure (canonical port) 2026-06-10 14:39:02 -04:00
stage3-io-ns-spec.janet core: edn :readers/:default opts; uncaught throws no longer leak the callee's ns 2026-06-10 18:16:06 -04:00
state-spec.janet feat: run the real clojure.tools.logging (defmacro/syntax-quote/ns + host shims) 2026-06-13 18:50:53 -04:00
strings-spec.janet feat: run the real clojure.tools.logging (defmacro/syntax-quote/ns + host shims) 2026-06-13 18:50:53 -04:00
transducers-spec.janet core: transduce/eduction/->Eduction to the overlay; into stays seed (perf wall) 2026-06-11 13:52:35 -04:00
transients-spec.janet feat(strictness): subs validates bounds; assoc! bounds-checks vector index 2026-06-05 14:07:14 -04:00
truthiness-spec.janet test: fold ported-clojure batteries into spec 2026-06-05 07:50:16 -04:00
untested-vars-spec.janet core: print-method is a real multimethod (jolt-g1r); records print canonically 2026-06-11 18:10:11 -04:00
uuid-spec.janet core: proper uuid support — fix random-uuid, add parse-uuid, real uuid values 2026-06-10 10:27:24 -04:00
vectors-spec.janet Compiler research (#10) 2026-06-09 07:30:25 +08:00
walk-spec.janet Fix clojure.walk to descend lists and seqs (jolt-khk) 2026-06-15 10:16:47 -04:00