add satisfies-protpath?
This commit is contained in:
parent
0bb3ac8440
commit
c3164d722d
3 changed files with 14 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
## 1.0.1-SNAPSHOT
|
||||
|
||||
* Add `satisfies-protpath?`
|
||||
* Inline cache vars are marked private so as not to interfere with tooling
|
||||
* Bug fix: Using `pred` no longer inserts unecessary `coerce-nav` call at callsite
|
||||
* Bug fix: Dynamic navs in argument position to another nav now properly expanded and compiled
|
||||
|
|
|
|||
|
|
@ -430,6 +430,9 @@
|
|||
(let [inav# ~retrieve]
|
||||
(i/exec-transform* inav# ~@rargs))))))))
|
||||
|
||||
(defmacro satisfies-protpath? [protpath o]
|
||||
`(satisfies? ~(protpath-sym protpath) ~o))
|
||||
|
||||
(defn extend-protocolpath* [protpath-prot extensions]
|
||||
(let [m (-> protpath-prot :sigs keys first)
|
||||
params (-> protpath-prot :sigs first last :arglists first)]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
select-first transform setval replace-in
|
||||
select-any selected-any? collected? traverse
|
||||
multi-transform path dynamicnav recursive-path
|
||||
defdynamicnav traverse-all]]))
|
||||
defdynamicnav traverse-all satisfies-protpath?]]))
|
||||
(:use
|
||||
#?(:clj [clojure.test :only [deftest is]])
|
||||
#?(:clj [clojure.test.check.clojure-test :only [defspec]])
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
select-first transform setval replace-in
|
||||
select-any selected-any? collected? traverse
|
||||
multi-transform path dynamicnav recursive-path
|
||||
defdynamicnav traverse-all]]))
|
||||
defdynamicnav traverse-all satisfies-protpath?]]))
|
||||
|
||||
|
||||
|
||||
|
|
@ -1513,3 +1513,11 @@
|
|||
(is (= [1] (foo 1)))
|
||||
(is (= [10] (foo 10)))
|
||||
))
|
||||
|
||||
(defprotocolpath FooPP)
|
||||
(extend-protocolpath FooPP String s/STAY)
|
||||
|
||||
(deftest satisfies-protpath-test
|
||||
(is (satisfies-protpath? FooPP "a"))
|
||||
(is (not (satisfies-protpath? FooPP 1)))
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue