Fork me on GitHub
#clj-kondo
<
2023-02-02
>
Braden Shepherdson16:02:26

I'm getting odd behavior from the relatively-new :unused-value. I've got a macro used like

(mt/with-temp-env-var-value [not-a-real-binding (name (:some-key defaults))]
  ;; body...
  )
that has [:hooks :macroexpand] rules that turn it into
(defmacro with-temp-env-var-value [bindings & body]
  `(do
     ~@(map second (partition-all 2 bindings))
     ~@body))

Braden Shepherdson16:02:08

it's flagging the (name (:some-key defaults)) as "unused value". if I replace it with 7, (:some-key defaults), or even (-> defaults :some-key name), it doesn't complain.

Braden Shepherdson16:02:55

that last especially makes it feel like a bug in the linter, since that should itself produce identical expanded code to the original.