Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of reader conditional after ^ #970

Closed
sogaiu opened this issue Aug 25, 2020 · 10 comments
Closed

Handling of reader conditional after ^ #970

sogaiu opened this issue Aug 25, 2020 · 10 comments

Comments

@sogaiu
Copy link
Contributor

sogaiu commented Aug 25, 2020

version

clj-kondo v2020.07.30-SNAPSHOT 2fb6175

platform

Linux, native-image (locally built)

problem

Reader conditional appearing after ^ appears to lead to an error.

To be specific, code like:

^#?(:clj :a :cljr :b) [:smile]

yields an error via a clj-kondo with the above version like:

error: keyword :clj is called with 3 args but expects 1 or 2

In the wild, some examples of code that trigger this can be seen at:

repro.cljc:

(ns my.ns)

^#?(:clj :a :cljr :b) [:smile]

output of clj-kondo --lint repro.cljc:

repro.cljc:3:11: error: keyword :clj is called with 3 args but expects 1 or 2
linting took 27ms, errors: 1, warnings: 0

expected behavior

The expected behavior is to not report an error as the construct appears to be correct in Clojure.

related

Related issue in parcera: carocad/parcera#80

@stale
Copy link

stale bot commented Dec 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the expired expired - might be closed due to too little activity label Dec 3, 2021
@borkdude borkdude removed the expired expired - might be closed due to too little activity label Dec 3, 2021
@borkdude
Copy link
Member

borkdude commented Dec 3, 2021

#785 and this one seem to be duplicates?

@sogaiu
Copy link
Contributor Author

sogaiu commented Dec 3, 2021

Oh may be so. Sorry about that!

@borkdude
Copy link
Member

borkdude commented Dec 4, 2021

No worries. Feel free to close one of your liking :)

@borkdude
Copy link
Member

@sogaiu This has already been fixed in a previous release of clj-kondo. Please report if you find that this isn't the case with the newest version of clj-kondo.

@sogaiu
Copy link
Contributor Author

sogaiu commented Dec 15, 2021

@borkdude I tried with 89544bd but still get the same output:

$ clj-kondo --lint -
^#?(:clj :a :cljr :b) [:smile]
<stdin>:1:4: error: keyword :clj is called with 3 args but expects 1 or 2
linting took 3548ms, errors: 1, warnings: 0

$ clj-kondo --version
clj-kondo v2021.12.02-SNAPSHOT

This was with a local build -- perhaps I didn't get that right or messed up in some other way...

@borkdude
Copy link
Member

borkdude commented Dec 16, 2021 via email

@sogaiu
Copy link
Contributor Author

sogaiu commented Dec 16, 2021

Ah right. Thanks! I never seem to learn that :)

Ok, this is what I get now:

$ clj-kondo --lang cljc --lint -
^#?(:clj :a :cljr :b) [:smile]
<stdin>:0:0: error: Can't parse <stdin>, No implementation of method: :sexpr of protocol: #'clj-kondo.impl.rewrite-clj.node.protocols/Node found for class: nil
linting took 9255ms, errors: 1, warnings: 0

Interestingly, it works for the following:

$ clj-kondo --lang cljc --lint -
^#?(:clj :a :cljs :b) [:smile]
linting took 16166ms, errors: 0, warnings: 0

So may be it's because of :cljr?

I guess that's a different thing then.

@borkdude borkdude reopened this Dec 16, 2021
@borkdude
Copy link
Member

Can reproduce with :cljr, thanks.

@borkdude
Copy link
Member

Fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants