Skip to content

Commit ee1d297

Browse files
borkdudeswannodette
authored andcommitted
CLJS-3049: Undefined fdef is still present in result of (stest/checkable-syms)
1 parent 65e3e40 commit ee1d297

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@
6868
[k spec-form]
6969
(let [k (if (symbol? k) (ns-qualify &env k) k)
7070
form (res &env spec-form)]
71-
(swap! registry-ref assoc k form)
71+
(swap! registry-ref (fn [r]
72+
(if (nil? form)
73+
(dissoc r k)
74+
(assoc r k form))))
7275
`(def-impl '~k '~form ~spec-form)))
7376

7477
(defmacro spec

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

+9
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,12 @@
186186
(is (= [2 3] (next [1 2 3])))
187187
(is (thrown-with-msg? js/Error #"Call to #'cljs.core/next did not conform to spec\." (next 1)))
188188
(is (= '[cljs.core/next] (stest/unstrument `next))))
189+
190+
(defn cljs-3049 [x] x)
191+
(deftest test-3049
192+
(s/fdef cljs-3049 :args (s/cat :x number?) :ret number?)
193+
(testing "the spec'ed fn is checkable"
194+
(is (contains? (stest/checkable-syms) `cljs-3049)))
195+
(s/def cljs-3049 nil)
196+
(testing "the spec'ed fn is not checkable anymore"
197+
(is (not (contains? (stest/checkable-syms) `cljs-3049)))))

0 commit comments

Comments
 (0)