(case [1 1]
[a a] true ;; unused definition: a
_ false)
a
is implicitly used when checking that both elements are equal.
Actually, this one has a different root cause than fennel-ls#22.
Fennel-ls doesn't have the builtin macros built in; it actually depends on the macroexpansion, and then maps the lints back to the source AST if the corresponding AST elements are present in both. Unfortunately, in the macroexpansion,
a
is actually unused.(let [(_1_) [1 1]] (if (and (= (_G.type _1_) "table") (not= nil (. _1_ 1)) (= (. _1_ 1) (. _1_ 2))) (let [a (. _1_ 1)] true) true (let [_ _1_] false)))This means there's not much I can do to make this go away unless I start hardcoding special behaviors for specific macros.
Implemented this in e5dc047 by ignoring unused locals ending in underscores same as #23.
To be clear, the solution is to change your code like so:
(case [1 1] [a_ a_] true _ false)A trailing _ suppresses the lint without changing the meaning of the pattern.