Fork me on GitHub
Chris McCormick12:11:15

Hello, I have {:lint-as {promesa.core/let clojure.core/let}} in .clj-kondo/config.edn and I am seeing Unresolved symbol: a for (p/let [a 12]) - is this expected behaviour?


Can you point me to the repo?

Chris McCormick12:11:53

it happens in the p/let at the bottom of this: the clj-kondo config is in that same dir.


Can't reproduce. Can you execute clj-kondo --lint server.cljs on the command line and see what it produces? Are you sure this is coming from clj-kondo and not some other linter?

Chris McCormick12:11:31

Oh maybe you're right, maybe my setup is wrong. I'll investigate, thanks.

Chris McCormick12:11:13

/home/chrism/bin/clj-kondo --lint - < server.cljs 
<stdin>:32:11: error: Unresolved symbol: self
If I directly run it it fails to find the file, even though it's definitely there:
$ /home/chrism/bin/clj-kondo --lint server.cljs 
server.cljs:0:0: error: file does not exist
linting took 31ms, errors: 1, warnings: 0
I installed from the AppImage by copying it into ~/bin which is on my path. :thinking_face:


are you inside the template directory?


file does not exist indicative of ... the file does not exist

Chris McCormick12:11:46

$ pwd
$ clj-kondo --lint server.cljs
server.cljs:0:0: error: file does not exist
linting took 31ms, errors: 1, warnings: 0
$ ls -alh server.cljs 
-rw-rw-r-- 1 chrism chrism 1.3K Oct 31 13:08 server.cljs

Chris McCormick12:11:00

could this be a strange bug with the appimage version not resolving paths correctly?

Chris McCormick12:11:26

maybe i shouldn't be doing this?

$ ls -alh ~/bin/clj-kondo 
lrwxrwxrwx 1 chrism chrism 75 Oct 27 13:04 /home/chrism/bin/clj-kondo -> contrib/clj-kondo-2021.09.25-lp151.73.1.Build73.1.glibc2.14-x86_64.AppImage


I don't know what appimage is. Just install it from github releases using the installer script

Chris McCormick12:11:48

oh ok, its linked from the clj-kondo docs

Chris McCormick12:11:21

> There is also an If you use the AppImage, simply save the file as "clj-kondo" and make it executable. It is fully self-contained - without the overhead that comes with Docker!


I guess I'll just comment that out then since it doesn't seem to work

Chris McCormick12:11:34

Ok using the installer with --dir /home/chrism/bin has fixed the issue. Sorry for the noise!

Chris McCormick12:11:41

Thanks for your hlep.

Joshua Suskalo19:11:25

Hey @borkdude is there a good way for me to specify in clj-kondo hooks that a value is bound, but we don't know to what? I can't use an anonymous function because that causes incorrect behavior wr/t recur linting, and if I bind the values to nil in a let block then I get type errors in the code inside it.

Joshua Suskalo20:11:04

The solution I ended up coming up with is to emit a let block that looks like this:

(let [some-binding (clojure.core/first nil)]
  (+ some-binding 2))
The problem before was that some-binding was giving me warnings about being nil and passed to +, so more or less I wanted to emit an untyped binding form.

Joshua Suskalo20:11:14

I don't really consider this ideal, but it's good enough I guess


@suskeyhose bind to a number perhaps? or does that also cause type errors for other situations?


yeah on the first or second?

Joshua Suskalo21:11:22

it also causes type errors

Joshua Suskalo21:11:27

for anything that like needs a sequence

Joshua Suskalo21:11:35

The hook is controlling what value is bound

Joshua Suskalo21:11:38

it's not in my code

Joshua Suskalo21:11:59

practically speaking it's like making a function call, but there's no actual function call boundary and recur goes back to an outer recur point


Can you give some examples of how this looks?

Joshua Suskalo21:11:22

(loop []
      (far/error ::some-error)
    (::far/use-value [v]
This recur will recur back to loop, but the ::far/use-value clause is called like a function (in some handler on a different part of the stack)


so this is a macro which expands the keyword ::far/use-value into something like fn?


can you show what it expands into? less guesswork for me

Joshua Suskalo21:11:47

it's like fn, but in reality it's like getting the values out of an exception and destructing them inside a let statement

Joshua Suskalo21:11:57

the expansion is.... complex


then an expansion that only illustrates the idea but dumbed down?

Joshua Suskalo21:11:36

(loop []
  (let [[v] (try (far/error ::some-error)
                 (catch Signal s (.-args s))]

Joshua Suskalo21:11:47

that's more or less what it ends up doing, but very simplified


I think you could just expand into something like

(let [{:keys [v] {}] ..)
clj-kondo isn't currently looking at the contents of the map literal to deduce that v is nil

Joshua Suskalo21:11:19

okay, I can try that.


@suskeyhose off topic question: did you get anything working in graalvm jdk 17 with panama + native image?


I'm wondering if I should upgrade to jdk 11 21.3.0 or jdk 17 21.3.0

Joshua Suskalo14:11:41

I had some other stuff that took a lot of my free time, so I haven't had the chance yet.