I’m playing with the new :key!, :select, etc in Clojure 1.13.0-alpha5, and I think I’ve found an issue with clj-kondo and :select.
This is fine:
(defn foo1 [{:keys [c & :d]
:select select}]
[select])
This gives a “clojure.lang.Keyword cannot be cast to clojure.lang.IPersistentMap” error:
(defn foo2 [{:keys [c & :d]
:select select}]
select)
This also gives that error:
(defn foo3 [{:keys [c & :d]
:select select}]
{:select select})
Happy to create an issue if need be.
Are you on the latest clojure-lsp nightly? I may have fixed this error but not sure, I'll peek back here later
Yes, but I also tried directly with a local clone of clj-kondo — at commit:
03bbe1fd Remove stray ctx argument in analyze-loop dissoc (#2914)
…running with clj -M:dev --lint <path-to-my-file>
@nomiskatz that error looks like a runtime Clojure error, not a static clj-kondo error. When exactly do you get that error?
Yes, a runtime Clojure error. Sorry, should have been clearer.
So... not clj-kondo?
Yes, clj-kondo. When I run clj-kondo it crashes.
Confirmed. I cloned clj-kondo, add simon.clj at the root with Simon's code, ran lint on it per his command and got:
[[clojure.lang.RT dissoc "RT.java" 891]
[clojure.core$dissoc invokeStatic "core.clj" 1526]
[clojure.core$dissoc invokeStatic "core.clj" 1519]
[clojure.core$dissoc doInvoke "core.clj" 1519]
[clojure.lang.RestFn invoke "RestFn.java" 490]
[clj_kondo.impl.types.utils$strip_positions$fn__4684
invoke
"utils.clj"
282]
[clojure.core$update_vals$fn__8943 invoke "core.clj" 8018]
[clojure.lang.PersistentArrayMap
kvreduce
"PersistentArrayMap.java"
429]
[clojure.core$fn__8525 invokeStatic "core.clj" 6909]
[clojure.core$fn__8525 invoke "core.clj" 6889]
[clojure.core.protocols$fn__8257$G__8252__8266
invoke
"protocols.clj"
175]
[clojure.core$reduce_kv invokeStatic "core.clj" 6920]
[clojure.core$update_vals invokeStatic "core.clj" 8019]
[clojure.core$update_vals invoke "core.clj" 8009]
[clojure.core$update invokeStatic "core.clj" 6234]
[clojure.core$update invoke "core.clj" 6224]
[clj_kondo.impl.types.utils$strip_positions
invokeStatic
"utils.clj"
280]
[clj_kondo.impl.types.utils$strip_positions invoke "utils.clj" 273]
[clj_kondo.impl.types$resolve_arity invokeStatic "types.clj" 893]
[clj_kondo.impl.types$resolve_arity invoke "types.clj" 882]
[clj_kondo.impl.types$resolve_types$fn__5023$fn__5024
invoke
"types.clj"
925]
[clojure.lang.PersistentArrayMap
kvreduce
"PersistentArrayMap.java"
429]
[clojure.core$fn__8525 invokeStatic "core.clj" 6909](and (map? t) (:val t))
(update t :val update-vals
(fn [e]
(let [e (dissoc e :row :col :end-row :end-col)]
(if (:tag e)
(update e :tag strip-positions)
e))))
I guess (:val t) is not a map here.Issue fixed on clj-kondo master
Thanks — I confirm all is good now.
you're running from git/JVM?
Checking using a local clone, running with clj -M:dev --lint <path-to-my-file>
But usually from clojure-lsp.
ah yes that works too. I personally run clojure-lsp + clj-kondo from local git repos in a JVM
so I wondered if you did that since you tested it so fast :)