core: variadic bit ops, set? covers sorted sets, if rejects extra forms
Three canonical-conformance fixes from the post-shrink batch: - bit-and/bit-or/bit-xor/bit-and-not get Clojure's variadic arities as 20-coll shells folding the binary host ops (now __bit-* seams). 2-arg call sites still compile to the native janet op via the backend's native-ops table. The passes.clj constant-fold table now names the seams — the public fns are overlay and don't exist when the compiler loads (this briefly broke every compile-mode init). - core-set? recognizes the :jolt/sorted-set representation (jolt-dpn): (set? (sorted-set 1)) was false, and ifn? on sorted sets inherited the bug. - (if) / (if test) / (if test then else extra) throw in both the analyzer and the interpreter — spec 03-special-forms X1, now marked verified. Suite 4704 -> 4706; bench and the greeter example benchmark are flat.
This commit is contained in:
parent
621dc8e310
commit
c6f6b7deb7
9 changed files with 84 additions and 16 deletions
|
|
@ -1450,7 +1450,8 @@
|
|||
(defn core-hash-set [& xs]
|
||||
(apply make-phs xs))
|
||||
|
||||
(defn core-set? [x] (set? x))
|
||||
# sorted sets are tagged tables the host set? predicate misses (jolt-dpn)
|
||||
(defn core-set? [x] (or (set? x) (core-sorted-set? x)))
|
||||
(defn core-disj [s & ks]
|
||||
(cond
|
||||
(core-sorted-set? s) ((sorted-op s :disj) s ks)
|
||||
|
|
@ -2782,9 +2783,9 @@
|
|||
"init-proxy" core-init-proxy
|
||||
"get-proxy-class" core-get-proxy-class
|
||||
# Bit operations
|
||||
"bit-and" core-bit-and
|
||||
"bit-or" core-bit-or
|
||||
"bit-xor" core-bit-xor
|
||||
"__bit-and" core-bit-and
|
||||
"__bit-or" core-bit-or
|
||||
"__bit-xor" core-bit-xor
|
||||
"bit-not" core-bit-not
|
||||
"bit-shift-left" core-bit-shift-left
|
||||
"bit-shift-right" core-bit-shift-right
|
||||
|
|
@ -2792,7 +2793,7 @@
|
|||
"bit-set" core-bit-set
|
||||
"bit-flip" core-bit-flip
|
||||
"bit-test" core-bit-test
|
||||
"bit-and-not" core-bit-and-not
|
||||
"__bit-and-not" core-bit-and-not
|
||||
"unsigned-bit-shift-right" core-unsigned-bit-shift-right
|
||||
# Integer coercion / unchecked math
|
||||
"int" core-int
|
||||
|
|
|
|||
|
|
@ -1531,10 +1531,14 @@
|
|||
(set result (eval-form ctx bindings (in form i)))
|
||||
(++ i)))
|
||||
result)
|
||||
"if" (let [test-val (eval-form ctx bindings (in form 1))]
|
||||
(if (and (not (nil? test-val)) (not (= false test-val)))
|
||||
(eval-form ctx bindings (in form 2))
|
||||
(if (> (length form) 3) (eval-form ctx bindings (in form 3)) nil)))
|
||||
"if" (do
|
||||
# 2 or 3 argument forms only (spec 03-special-forms X1)
|
||||
(when (or (< (length form) 3) (> (length form) 4))
|
||||
(error (string "Wrong number of args (" (dec (length form)) ") passed to: if")))
|
||||
(let [test-val (eval-form ctx bindings (in form 1))]
|
||||
(if (and (not (nil? test-val)) (not (= false test-val)))
|
||||
(eval-form ctx bindings (in form 2))
|
||||
(if (> (length form) 3) (eval-form ctx bindings (in form 3)) nil))))
|
||||
"def" (let [raw-name (in form 1)
|
||||
name-sym (unwrap-meta-name raw-name)
|
||||
# Metadata on the name: keyword/type-hint metadata rides on the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue