Fork me on GitHub
#clj-kondo
<
2021-06-29
>
nikolavojicic13:06:23

(alias 'sn (create-ns 'some-namespace))
::sn/foo ;=> :some-namespace/foo
... Unresolved namespace sn. Are you missing a require?

nikolavojicic13:06:52

How to avoid this warning? Note: there is no file some_namespace.clj so I can't require it.

borkdude13:06:51

(alias 'sn (create-ns 'some-namespace))
::sn/foo ;; false positive
sn/foo ;; works
yes, this seems a bug, feel free to post an issue

👍 2
borkdude13:06:43

ah no, I was fooled, clj-kondo only reports the first occurrence of the unresolved namespace

borkdude13:06:07

this does seem to work:

(alias 'sn 'foo #_(create-ns 'some-namespace))
::sn/foo

borkdude13:06:29

this could be improved though, so issue still welcome

borkdude13:06:52

for now you could write:

(create-ns 'foo)
(alias 'sn 'foo)
::sn/foo

nikolavojicic13:06:36

Ok, I will post an issue. Thx for workaround.

Joshua Suskalo22:06:18

Are there any common causes for unsupported binding form errors to occur in code generated by hooks?

borkdude22:06:59

@suskeyhose it's usually best to just print the node to see what it looks like

Joshua Suskalo22:06:06

Like right now I'm just putting a symbol into a vector used in an argument list to a fn

Joshua Suskalo22:06:13

Yeah, I'm printing the node, and it looks fine

Joshua Suskalo22:06:58

<list: (fn [] (fn [field value second item timestamp] [field value second item timestamp] [second field] {:type :http :method :get :body {:field field :value value :timestamp timestam}} ()))>

Joshua Suskalo22:06:02

This is what's being generated

Joshua Suskalo22:06:23

And it's saying timestamp is an unsupported binding form.

Joshua Suskalo22:06:46

Oh, I think I might know

Joshua Suskalo22:06:53

I forgot to turn the symbol into a token node

borkdude22:06:02

right, that's a common thing

Joshua Suskalo22:06:07

yup, that was it