I found a “problem” with defmethod
because defmethod expects & fn-tail
it is possible to set local binding for the function that implement that particular method. but clj-kondo give me an error for such case
@delaguardo Can you post this code as text instead of screenshot?
(require '[clojure.string :as string])
(defmulti example :tag)
(defmethod example :node
f
([] "NODE: ")
([{:keys [children]}]
(str (f) (string/join " " (map example children)))))
(defmethod example :leaf
f
([] "LEAF: ")
([{:keys [value]}]
(str (f) value)))
surethis is definitely an edge case which I never saw in real examples so I came here to check if this is something that should be addressed in clj-kondo.
ah, so multimethods fns can be named. didn't know that So a working example would be:
(prn
(example {:tag :node :children [{:tag :leaf :value 1}]}))
it also works with bb :)
$ bb /tmp/mm.clj
"NODE: LEAF: 1"
Feel free to make an issue about this
you can ignore the false positive with #_:clj-kondo/ignore (f)
:thumbsup: