Fork me on GitHub
#qa
<
2019-09-14
borkdude10:09:59

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.

sogaiu10:09:50

is it the typing branch?

borkdude10:09:18

sorry, yes. updated

sogaiu10:09:31

np, building now 🙂

sogaiu10:09:26

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

borkdude10:09:52

Sure, if they are relevant

sogaiu10:09:24

lol, how would i know, i wonder 🙂

borkdude10:09:53

What does the error message say for example?

sogaiu10:09:42

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.

sogaiu10:09:15

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

sogaiu10:09:32

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

sogaiu10:09:29

no, that's probably pebkac

sogaiu10:09:40

i probably gave a bad path

borkdude10:09:49

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

sogaiu10:09:13

will have a look at least

borkdude10:09:16

Or just post the permalink to the core, also fine

borkdude10:09:20

Code of the failing example I mean

sogaiu10:09:13

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)))

borkdude10:09:11

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

sogaiu10:09:17

sounds good

borkdude12:09:17

@sogaiu both problems fixed

borkdude12:09:25

nil is also seqable, so that's right