Fork me on GitHub
#clj-kondo
<
2021-12-08
>
lassemaatta10:12:21

if I have a fn-like macro, which introduces a symbol within the scope of the body, I can use :unresolved-symbol to tell clj-kondo to exclude the symbol. But what if I have a macro, which uses a binding from the outer scope from the call site? Naturally clj-kondo doesn't know that the macro uses the binding and I will (assuming no one else uses it) get an unused binding warning.

borkdude10:12:59

@lasse.olavi.maatta can you sketch an example of what the usage looks like?

lassemaatta10:12:36

(don't ask me why someone wrote a macro like that..)

borkdude10:12:22

I would rewrite this macro to take the a binding explicitly

borkdude10:12:50

or make another arity which does that, to keep compatibility with the old callers

borkdude10:12:55

or you can make a wrapper macro which does that

borkdude10:12:24

if this is not possible, then you can write a hook to expand the some-macro into code which does use the a binding

lassemaatta10:12:40

yeah, there's probably plenty of ways to fix the original code