metosin / spec-tools

Clojure(Script) tools for clojure.spec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spec-tools.parse/parse-form 'spec-tools.core/merge throws when merging with symbol

slipset opened this issue · comments

(s/def ::bar string?)
(s/def ::qix string?)
(s/def ::foo (s/keys :req-un [::bar]))
(s/def ::baz (s/keys :req-un [::qix]))
(spec-tools/merge ::foo ::bar)
;; works fine
(def bar ::bar)
(spec-tools/merge ::foo bar)
;; throws
(defmethod parse-form 'spec-tools.core/merge [_ form]
  (let [type-priority #({:map        1
                         :multi-spec 0} (:type %) 0)]

    (apply impl/deep-merge (->> (rest form)
                                (map parse-spec)
                                (sort-by type-priority)))))

makes the problem go away, but not sure if it's a correct fix

Hi, seems like the problem went away with the current state of master. There were a PR related to this symbol problem that might have fixed this as well. I can't reproduce the failure example now.

Fixed in master