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

Doesn't know simple-benchmark from cljs core #1079

Closed
wiseman opened this issue Nov 24, 2020 · 1 comment
Closed

Doesn't know simple-benchmark from cljs core #1079

wiseman opened this issue Nov 24, 2020 · 1 comment
Labels
enhancement New feature or request
Projects

Comments

@wiseman
Copy link

wiseman commented Nov 24, 2020

version

clj-kondo v2020.11.07

platform

Native, I believe.

problem

When I use [simple-benchmark from cljs core](https://cljs.github.io/api/cljs.core/simple-benchmark, like this:

(defn benchmark []
  (simple-benchmark [x 1000]
    (* x x)
    100))

clj-kondo issues an error:

error: unresolved symbol x

repro

(ns repro)


(defn benchmark []
  (simple-benchmark [x 1000]
    (* x x)
    100))
$ clj-kondo --lint repro.cljs
repro.cljs:5:22: error: unresolved symbol x
linting took 16ms, errors: 1, warnings: 0

expected behavior

I would expect clj-kondo to know constructs from cljs.core, and understand that the simple-benchmark form defines bindings.

@borkdude
Copy link
Member

@wiseman Thanks. clj-kondo knows about the var:

$ clj-kondo --lint /tmp/foo.cljs
/tmp/foo.cljs:1:1: error: cljs.core/simple-benchmark is called with 0 args but expects 3 or more
linting took 13ms, errors: 1, warnings: 0
$ cat /tmp/foo.cljs
(simple-benchmark)

but it doesn't yet know about the syntax.

Workaround via config:

(ns foo
  {:clj-kondo/config {:lint-as {cljs.core/simple-benchmark clojure.core/let}}})

(simple-benchmark [x 100]
                  x 200)

@borkdude borkdude added this to Needs triage in clj-kondo via automation Nov 24, 2020
@borkdude borkdude moved this from Needs triage to High priority (next release) in clj-kondo Nov 24, 2020
@borkdude borkdude added the enhancement New feature or request label Nov 24, 2020
@borkdude borkdude moved this from High priority (next release) to In progress in clj-kondo Dec 6, 2020
@borkdude borkdude moved this from In progress to Next release in clj-kondo Dec 6, 2020
clj-kondo automation moved this from Next release to Done Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
clj-kondo
  
Done
Development

No branches or pull requests

2 participants