clojure.string toString coercion; some-fn/ifn? reference semantics; misc host gaps

The clojure.string case fns and searches now take any Object s through its
toString like the reference's ^CharSequence signatures ((upper-case :kw) is
":KW", (capitalize 1) is "1"); nil throws, and a nil substr in
starts-with?/ends-with? throws. some-fn re-ported with the reference
arities: (some-fn) is an arity error and a no-match result is the last
predicate's own falsy value (false, not nil). ifn? covers multimethods,
promises (which are now invocable — calling one delivers, via a cold-path
invoke-arm registry that costs the hot dispatch nothing), and deftypes
implementing IFn's invoke.

One structural find on the way: defmulti/defmethod deferred inside a fn
body (the deftest pattern) interned/resolved in whatever namespace was
current when they RAN, not the one they were written in — the macros now
bake their expansion ns and the setups honor it.

Also: Boolean/Integer/Double wrapper ctors, primitive TYPE statics
(Integer/TYPE etc.), .reduce on collections (IReduce), and Long/TYPE.

cts baseline 5857 -> 5904 pass, 58 -> 28 errors, 57 baselined namespaces —
the string cluster, some-fn, ifn-qmark, boolean-qmark, and reduce
namespaces are all fully clean. 7 JVM-certified corpus rows; spec entry.
This commit is contained in:
Yogthos 2026-07-02 11:38:37 -04:00
parent a9542077fc
commit e17bcfd0af
15 changed files with 1100 additions and 941 deletions

View file

@ -3558,4 +3558,11 @@
{:suite "casts / checked narrow" :label "float range-checks against Float/MAX_VALUE" :expected "[:iae 1.5]" :actual "[(try (float 1e300) (catch IllegalArgumentException _ :iae)) (float 1.5)]"}
{:suite "casts / unchecked wrap" :label "unchecked casts wrap and sign-fold; doubles saturate" :expected "[-56 -25536 \\A 9223372036854775807 0 0]" :actual "[(unchecked-byte 200) (unchecked-short 40000) (unchecked-char 65) (unchecked-long 1e300) (unchecked-int 4294967296) (unchecked-long ##NaN)]"}
{:suite "ns / requiring-resolve" :label "loads the namespace then resolves; unqualified throws" :expected "[#{1 2} :iae]" :actual "[((requiring-resolve (quote clojure.set/union)) #{1} #{2}) (try (requiring-resolve (quote unqualified)) (catch IllegalArgumentException _ :iae))]"}
{:suite "string / toString coercion" :label "case fns and searches take any Object through toString" :expected "[\":ASDF/X\" \"asdf\" \"1\" true true]" :actual "[(clojure.string/upper-case :asdf/x) (clojure.string/lower-case (quote ASDF)) (clojure.string/capitalize 1) (clojure.string/starts-with? :ab \":a\") (clojure.string/ends-with? (quote ab) \"b\")]"}
{:suite "string / toString coercion" :label "nil s throws; nil substr throws" :expected "[:t :t :t]" :actual "[(try (clojure.string/upper-case nil) (catch Throwable _ :t)) (try (clojure.string/starts-with? \"\" nil) (catch Throwable _ :t)) (try (clojure.string/escape nil {}) (catch Throwable _ :t))]"}
{:suite "core / some-fn" :label "returns the last predicate value (false, not nil); zero preds is an arity error" :expected "[false 2 :ae]" :actual "[((some-fn even?) 1) ((some-fn :a :b) {:b 2}) (try (some-fn) (catch clojure.lang.ArityException _ :ae))]"}
{:suite "core / ifn?" :label "multimethods and promises are IFn; promises deliver when invoked" :expected "[true true 7]" :actual "[(do (defmulti ifnq-mm identity) (ifn? ifnq-mm)) (ifn? (promise)) (let [p (promise)] (p 7) (deref p))]"}
{:suite "multimethods / deferred definition" :label "defmulti/defmethod inside a fn intern in the ns they were written in" :expected ":hit" :actual "((fn [] (defmulti cdm-deferred first) (defmethod cdm-deferred :a [_] :hit) (cdm-deferred [:a 1])))"}
{:suite "host-interop / wrapper ctors and TYPE" :label "Boolean/Integer/Double ctors; primitive TYPE tokens" :expected "[false true 12 1.5 \"int\" \"double\"]" :actual "[(Boolean. \"yes\") (Boolean. \"TRUE\") (Integer. \"12\") (Double. \"1.5\") (str Integer/TYPE) (str Double/TYPE)]"}
{:suite "host-interop / IReduce" :label ".reduce drives a collection's own reduce" :expected "[7 6]" :actual "[(.reduce [1 2 3] + 1) (.reduce [1 2 3] +)]"}
]

View file

@ -5,7 +5,6 @@ clojure.core-test.abs 1 0
clojure.core-test.add-watch 0 1
clojure.core-test.bigint 6 0
clojure.core-test.bit-set 1 0
clojure.core-test.boolean-qmark 0 3
clojure.core-test.compare 1 0
clojure.core-test.conj 1 0
clojure.core-test.contains-qmark 3 0
@ -19,7 +18,6 @@ clojure.core-test.eval 0 3
clojure.core-test.even-qmark 1 0
clojure.core-test.float 1 0
clojure.core-test.get 0 1
clojure.core-test.ifn-qmark 2 0
clojure.core-test.inc 1 0
clojure.core-test.int-qmark 3 0
clojure.core-test.intern 2 0
@ -44,14 +42,12 @@ clojure.core-test.quot 30 0
clojure.core-test.rand-nth 0 1
clojure.core-test.rational-qmark 3 0
clojure.core-test.realized-qmark 3 0
clojure.core-test.reduce 0 1
clojure.core-test.rem 21 0
clojure.core-test.remove-watch 0 1
clojure.core-test.run-bang 1 0
clojure.core-test.select-keys 2 0
clojure.core-test.seqable-qmark 1 0
clojure.core-test.shuffle 1 0
clojure.core-test.some-fn 3 0
clojure.core-test.sort-by 2 0
clojure.core-test.special-symbol-qmark 4 0
clojure.core-test.star 13 0
@ -62,9 +58,3 @@ clojure.core-test.vals 0 3
clojure.core-test.vec 1 0
clojure.core-test.when-let 1 0
clojure.edn-test.read-string 46 5
clojure.string-test.capitalize 0 4
clojure.string-test.ends-with-qmark 1 4
clojure.string-test.escape 1 0
clojure.string-test.lower-case 0 4
clojure.string-test.starts-with-qmark 1 10
clojure.string-test.upper-case 0 4