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

Conditional Reader macro on var definitions error #1414

Closed
leoiacovini opened this issue Oct 12, 2021 · 2 comments
Closed

Conditional Reader macro on var definitions error #1414

leoiacovini opened this issue Oct 12, 2021 · 2 comments

Comments

@leoiacovini
Copy link
Contributor

version
2021.09.25

platform

Using from clojure-lsp

editor

Using from clojure-lsp + calva

problem

clj-kondo seems to not parse properly metadata on vars definition that contains the Conditional Reader macro. Depending on the syntax it can go from making the namespace unparsable and the var not identified, to just not being made available for clj-kondo analysis afterward.

repro

  1. First case we get the following error: missing value for key #?@ (:clj [:deprecated "deprecation message"])
(def ^{#?@(:clj [:deprecated "deprecation message"])}
  my-deprecated-var
  :bla)
  1. Second error the var is parsed, but it is not marked as deprecated in the following usages:
(def ^#?(:clj {:deprecated "deprecation message"})
  my-deprecated-var
  :bla)

expected behavior

I would expect the code to be parsed correctly and the var would be displayed as deprecated when used inside the clj environment, but not on the cljs

@borkdude
Copy link
Member

@leoiacovini Fixed on master. Note that your second case doesn't work in CLJS: it also needs a :cljs or :default with an empty map there.

@borkdude
Copy link
Member

Screen Shot 2021-10-13 at 11 22 48

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