feat(strictness): first/rseq shape checks, assoc even-args + non-associative

- first throws on scalars (numbers/keywords/booleans/char & symbol structs)
- rseq is vector/sorted-only (throws on strings/maps/numbers/seqs)
- assoc requires an even kv count and a map/vector/nil receiver

first clean; rseq 12/1; assoc 39/3. clojure-test-suite pass 3864->3874.
spec: seq/more-strictness (11). jpm test green.
This commit is contained in:
Yogthos 2026-06-05 13:50:11 -04:00
parent ff3cc7d6c0
commit 2ca3fa4348
3 changed files with 36 additions and 5 deletions

View file

@ -18,7 +18,7 @@
# Baseline: assertions Jolt currently passes across the suite. Raise as Jolt
# improves so a regression (previously-passing assertion breaking) is caught.
(def baseline-pass 3860)
(def baseline-pass 3870)
# A file is "clean" when it ran with zero failures AND zero errors.
(def baseline-clean-files 45)
# Per-file wall-clock budget (seconds). Normal files finish in well under 1s;

View file

@ -165,3 +165,17 @@
["val on number" :throws "(val 0)"]
["key of entry" ":a" "(key (first {:a 1}))"]
["val of entry" "1" "(val (first {:a 1}))"])
# More strictness: first/rseq on the right shapes, assoc even-arg requirement.
(defspec "seq / more strictness"
["first on number" :throws "(first 42)"]
["first on keyword" :throws "(first :a)"]
["first ok vec" "1" "(first [1 2])"]
["first ok nil" "nil" "(first nil)"]
["rseq vector" "[3 2 1]" "(rseq [1 2 3])"]
["rseq on string" :throws "(rseq \"ab\")"]
["rseq on map" :throws "(rseq {:a 1})"]
["rseq on number" :throws "(rseq 0)"]
["assoc odd args" :throws "(assoc {:a 1} :b)"]
["assoc on number" :throws "(assoc 5 :a 1)"]
["assoc on set" :throws "(assoc #{} :a 1)"])