assoc! fills nil for a trailing lone key (JVM parity)
JVM assoc! is variadic: with a complete first pair present (>=3 kvs), a trailing
lone key fills nil ((assoc! t :a 1 :b) => {:a 1 :b nil}); a lone key alone (1 kv)
is still a wrong-arity throw. jolt delegated to the strict persistent assoc which
threw on any odd count. Pad a trailing nil for odd kvs >=3. Corpus 2688->2690.
This commit is contained in:
parent
c788e86f1a
commit
e7f5bcb58d
2 changed files with 9 additions and 3 deletions
|
|
@ -11,7 +11,7 @@
|
|||
;; reset between cases so there is no leakage — same isolation a fresh process gives.
|
||||
;;
|
||||
;; chez --script host/chez/run-corpus.ss
|
||||
;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2688)
|
||||
;; JOLT_CHEZ_ZJ_FLOOR=N override the regression floor (default 2690)
|
||||
;; JOLT_CORPUS_LIMIT=N every-Nth stride (fast iteration; floor drops to 0)
|
||||
;; JOLT_DUMP_CRASH_LABELS=1 list crash + allowlisted labels
|
||||
(import (chezscheme))
|
||||
|
|
@ -203,7 +203,7 @@
|
|||
|
||||
;; Regression floor: fail on any NEW divergence or if pass drops below the floor.
|
||||
(define base-floor (let ((s (getenv "JOLT_CHEZ_ZJ_FLOOR")))
|
||||
(if s (string->number s) 2688)))
|
||||
(if s (string->number s) 2690)))
|
||||
(define floor (if limit 0 base-floor))
|
||||
(when (or (> (length diverged) 0) (< pass floor))
|
||||
(printf "REGRESSION: pass ~a < floor ~a or ~a new divergence(s)\n"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,13 @@
|
|||
;; (assoc! t k v & kvs): variadic like Clojure (jolt-assoc already folds pairs).
|
||||
(define (jolt-assoc! t . kvs)
|
||||
(jolt-trans-check t "assoc!")
|
||||
(jolt-transient-coll-set! t (apply jolt-assoc (jolt-transient-coll t) kvs))
|
||||
;; JVM assoc! is variadic: once a complete first key/val pair is present (>=3
|
||||
;; kvs), a TRAILING lone key fills nil; a lone key alone (1 kv) is a wrong-arity
|
||||
;; throw (so don't pad it — the persistent assoc raises on odd args).
|
||||
(let ((kvs (if (and (>= (length kvs) 3) (odd? (length kvs)))
|
||||
(append kvs (list jolt-nil))
|
||||
kvs)))
|
||||
(jolt-transient-coll-set! t (apply jolt-assoc (jolt-transient-coll t) kvs)))
|
||||
t)
|
||||
(define (jolt-dissoc! t . ks)
|
||||
(jolt-trans-check t "dissoc!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue