Fork me on GitHub
#clj-kondo
<
2022-07-30
>
sheluchin12:07:16

clojure.core/defn-
  [name & decls]
  same as defn, yielding non-public def
Why does :varargs-min-arity differ for defn- in the usage and definition analysis?

sheluchin12:07:19

;; definition
{:ns clojure.core
 :name defn-
 :doc "same as defn, yielding non-public def"
 :varargs-min-arity 1
 :arglist-strs ["[name & decls]"]}

;; usage
{:name defn-,
 :filename "/tmp/foo.clj",
 :from foo,
 :macro true,
 :col 2,
 :arity 3,
 :varargs-min-arity 2,
 :row 8,
 :to clojure.core}

borkdude12:07:02

That's weird, but perhaps you can figure it out on kondo's source and report an issue about it?

sheluchin12:07:18

Yes, I can take a stab at that. I thought perhaps it's the correct result and I just misunderstood something, but if you concur that it's unusual, I'll take a look at the source and put some details in an issue.

sheluchin13:07:33

I think I understand the cause. It looks like overrides are not being applied to definitions, so the expected :varargs-min-arity 1 is reported for [name & decls], but for usages the overrides set :varargs-min-arity 2 https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/overrides.clj#L22-L25

sheluchin16:07:11

Tried to fix it but couldn't get to the bottom of it. I left some details https://github.com/clj-kondo/clj-kondo/issues/1758. Thanks! 🙏