Skip to content

Commit 341cf66

Browse files
committed
CLJS-2955: Self-host: spec check macro compile-time expansion
1 parent 6ccb629 commit 341cf66

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/main/cljs/cljs/spec/test/alpha.cljc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,16 @@ Returns a collection of syms naming the vars unstrumented."
224224
(validate-check-opts opts#)
225225
(check-1 nil ~f ~spec opts#))))
226226

227+
(defn- registry-ref []
228+
#?(:clj @#'s/registry-ref
229+
:cljs cljs.spec.alpha$macros/registry-ref))
230+
227231
(defn checkable-syms*
228232
([]
229233
(checkable-syms* nil))
230234
([opts]
231235
(reduce into #{}
232-
[(filter fn-spec-name? (keys @@#'s/registry-ref))
236+
[(filter fn-spec-name? (keys @(registry-ref)))
233237
(keys (:spec opts))])))
234238

235239
(defmacro checkable-syms
@@ -241,7 +245,7 @@ can be checked."
241245
`(let [opts# ~opts]
242246
(validate-check-opts opts#)
243247
(reduce conj #{}
244-
'[~@(filter fn-spec-name? (keys @@#'s/registry-ref))
248+
'[~@(filter fn-spec-name? (keys @(registry-ref)))
245249
~@(keys (:spec opts))]))))
246250

247251
(defmacro check

src/test/cljs/cljs/spec/test_test.cljs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@
113113

114114
(s/fdef cljs.core/= :args (s/+ any?))
115115

116+
(defn foo-2955 [n] "ret")
117+
118+
(s/fdef foo-2955
119+
:args (s/cat :n number?)
120+
:ret string?)
121+
122+
(deftest test-cljs-2955
123+
(is (seq (stest/check `foo-2955))))
124+
116125
(deftest test-cljs-2956
117126
(stest/instrument 'cljs.core/=)
118127
(is (true? (= 1)))

0 commit comments

Comments
 (0)