kibit
kibit copied to clipboard
Kibit confuses (:foo bar) and [:foo bar]
Given the code:
(fn [bar] [:foo bar])
Kibit will suggest replacing with
:foo
which is not equivalent.
It seems that kibit can't tell the two forms apart and is giving the suggestion for:
(fn [bar] (:foo bar))
I came here to report the same issue. So +1.
The same issue is present for all anonymous function forms resembling (fn [] [foo])
, where foo
is a symbol or keyword. See also issue #92. Relevant rule code is here.
Haven't had time to fully understand the semantics of the core.logic code in the relevant rule, but it seems like this could potentially have something to do with how core.logic handles unification of sequential things; the suspicious bit seems to involve clojure.core.logic/llist
.
Ran into this issue as well! A workaround is to use vector
.
;; Switch from this
(fn [bar] [:foo bar])
;; To this
(fn [bar] (vector :foo bar))
;; Or this :)
#(vector :foo %)