qa 2019-09-14

I implemented some local type checking / inference in clj-kondo. Any volunteers for testing? demo: https://twitter.com/borkdude/status/1172628472273035265 You can test by checking out https://github.com/borkdude/clj-kondo at the typing branch and lint random code using:

clojure -A:clj-kondo --lint <your-code> | grep Expected
The grep takes care of only displaying the type errors that clj-kondo found. Please report any false positives you may find in the smallest repro possible.

is it the typing branch?

sorry, yes. updated

np, building now 🙂

i tried running it against clojure's source and i see some errors under the test directory -- should i report those?

Sure, if they are relevant

lol, how would i know, i wonder 🙂

What does the error message say for example?

clojure/test/clojure/test_clojure/data_structures.clj:1130:44: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/logic.clj:109:14: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/sequences.clj:110:16: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/sequences.clj:173:49: error: Expected: seqable collection, received: positive integer.
clojure/test/clojure/test_clojure/sequences.clj:175:13: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/sequences.clj:176:15: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/sequences.clj:178:14: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/sequences.clj:822:14: error: Expected: seqable collection, received: nil.
clojure/test/clojure/test_clojure/serialization.clj:55:13: error: Expected: seqable collection, received: nil.

i ran it with tools.reader and got an exception -- should i report that?

java.lang.IllegalArgumentException: No matching clause: [:clj :edn]

no, that's probably pebkac

i probably gave a bad path

Seems relevant :-). Just one of those nil examples should be fine, would be nice if you could get it down to a small example

will have a look at least

Or just post the permalink to the core, also fine

Code of the failing example I mean

i think it's in here:

(deftest ordered-collection-equality-test
  (let [empty-colls [ []
                      '()
                      (lazy-seq)
                      clojure.lang.PersistentQueue/EMPTY
                      (vector-of :long) ]]
    (doseq [c1 empty-colls, c2 empty-colls]
      (is-same-collection c1 c2)))
  (let [colls1 [ [-3 :a "7th"]
                 '(-3 :a "7th")
                 (lazy-seq (cons -3
                   (lazy-seq (cons :a
                     (lazy-seq (cons "7th" nil)))))) ; <-------- this line is 1130
                 (into clojure.lang.PersistentQueue/EMPTY
                       [-3 :a "7th"])
                 (sequence (map identity) [-3 :a "7th"]) ]]
    (doseq [c1 colls1, c2 colls1]
      (is-same-collection c1 c2)))
  (is-same-collection [-3 1 7] (vector-of :long -3 1 7)))

AFK for a bit, I’ll check it out later

@sogaiu both problems fixed

nil is also seqable, so that's right