File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 5757
5858 Returns a spec."
5959 [form & {:keys [gen]}]
60- `(cljs.spec/spec-impl '~(res &env form) ~form ~gen nil ))
60+ (when form
61+ `(cljs.spec/spec-impl '~(res &env form) ~form ~gen nil )))
6162
6263(defmacro multi-spec
6364 " Takes the name of a spec/predicate-returning multimethod and a
251252 that returns a test.check generator."
252253 [& {:keys [args ret fn gen]}]
253254 (let [env &env]
254- `(cljs.spec/fspec-impl ~args '~(res env args) ~ret '~(res env ret) ~fn '~(res env fn ) ~gen)))
255+ `(cljs.spec/fspec-impl (spec ~args) '~(res env args)
256+ (spec ~ret) '~(res env ret)
257+ (spec ~fn) '~(res env fn ) ~gen)))
255258
256259(defmacro tuple
257260 " takes one or more preds and returns a spec for a tuple, a vector
Original file line number Diff line number Diff line change 10601060(defn ^:skip-wiki fspec-impl
10611061 " Do not call this directly, use 'fspec'"
10621062 [argspec aform retspec rform fnspec fform gfn]
1063- (assert (c/and argspec retspec))
10641063 (let [specs {:args argspec :ret retspec :fn fnspec}]
10651064 (reify
10661065 IFn
10671066 (-invoke [this x] (valid? this x))
10681067 ILookup
1069- (-lookup [this k]
1070- (-lookup this k nil ))
1071- (-lookup [_ k not-found]
1072- (case k
1073- :args argspec
1074- :ret retspec
1075- :fn fnspec
1076- not-found))
1068+ (-lookup [this k] (get specs k))
1069+ (-lookup [_ k not-found] (get specs k not-found))
10771070 Spec
10781071 (conform* [_ f] (if (fn? f)
10791072 (if (identical? f (validate-fn f specs *fspec-iterations*)) f ::invalid )
You can’t perform that action at this time.
0 commit comments