This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-24
Channels
- # aleph (1)
- # beginners (43)
- # calva (22)
- # cider (51)
- # clerk (1)
- # clj-kondo (20)
- # clojure (29)
- # clojure-denmark (1)
- # clojure-europe (73)
- # clojure-finland (28)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-spec (7)
- # clojure-uk (4)
- # clojurescript (12)
- # data-science (2)
- # datomic (51)
- # events (1)
- # fulcro (20)
- # hyperfiddle (28)
- # integrant (6)
- # malli (20)
- # matrix (2)
- # music (1)
- # off-topic (66)
- # reitit (17)
- # releases (5)
- # ring (1)
- # shadow-cljs (31)
- # xtdb (6)
clj-kondo displays a: Expected: map, received: seq
(probably derived from malli
annotations), in a function call that expects, and gets, a seq
. I would like to understand why clj-kondo thinks it's a map instead. Believing it could be a stale cache problem, I deleted .lsp/.cache
, but the annotation is still there. Any idea?
Here's a repro:
(def foo [:* :int])
(malli.core/=> bar [:=> [:cat foo] :keyword])
(defn bar [f] :ok)
(bar [1 2 3])
[1 2 3]
is underlined, and the error is expected: integer. received: vector
I updated my version of malli
and the error is still there. If you can't reproduce it @borkdude I can try bumping my clojure-mode
No, I see, it's an interaction between the malli :cat
schema and :*
. I though using [:vector :int]
was the same but that was just because my emacs took a bit to update and clerk was messing with malli instrumentation. If I just use [:vector :int]
, re-eval everything and then wait, the error is gone. thank you @borkdude!
I don't use malli, but I think https://github.com/metosin/malli#sequence-schemas describes this behaviour. Check the example after the "As all these examples show, the "seqex" operators take any non-seqex child schema..."
I'm having some false positives with something I think it's a new linter, https://github.com/clojure-lsp/clojure-lsp/blob/f21ecb0d643acc8536cceef93ab9d5edad86a685/lib/test/clojure_lsp/feature/completion_test.clj#L220
https://github.com/clj-kondo/clj-kondo/issues/2086 looks to be the same
This false positive can be traced back to Eastwood flagging swap! as a pure function or so I think
I’ll still have to look into it but I’m on a trip in London right now. Any research will be appreciated meanwhile :)
I bumped kondo in clojure-lsp and tests started to fail, after some bisect, I found that this https://github.com/clj-kondo/clj-kondo/commit/deb8326a24d610b9756989d83d6abb8efde70fa3 made that, any thoughts @borkdude?
https://github.com/clojure-lsp/clojure-lsp/actions/runs/5049440983/jobs/9058899676 in clojure-lsp
I think it's related with :clj-kondo/unknown-namespace removal as you mentioned before, I thought we didn't use, but I was wrong 😅
I don’t think it should have been in the analysis but perhaps you could explain what you were using it for
it has some logic to check if the var-usage has a :clj-kondo/unknown-namespace
on :to
to return the element itself, for example https://github.com/clojure-lsp/clojure-lsp/blob/8a8b47955c976f3ce0977889f95cd5f3a7058608/lib/src/clojure_lsp/queries.clj#L490.
So, for a code like:
(ns foo)
bar
AFAICS, now clj-kondo doesn't return any analysis for bar
where it used to return something like:
{:end-row 488,
:name-end-col 8,
:external? false,
:name-end-row 488,
:name-row 488,
:name bar,
:from foo,
:col 1,
:name-col 1,
:context {},
:uri "...",
:end-col 8,
:bucket :var-usages,
:row 488,
:to :clj-kondo/unknown-namespace}