Skip to content

Commit

Permalink
[#952] Fix false positive type warning with into and transducer
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Aug 31, 2020
1 parent 2871523 commit bb12c68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clj_kondo/impl/types.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:keyword #{:ifn}
:symbol #{:ifn}
:associative #{:seqable :coll :ifn}
:transducer #{:ifn}
:transducer #{:ifn :fn}
:list #{:seq :sequential :seqable :coll :stack}
:seq #{:seqable :sequential :coll}
:sequential #{:coll :seqable}})
Expand All @@ -51,6 +51,7 @@
:associative #{:map :vector :sequential :stack}
:ifn #{:fn :transducer :symbol :keyword :map :set :vector :associative :seqable :coll
:sequential :stack}
:fn #{:transducer}
:nat-int #{:pos-int}
:seq #{:list :stack}
:stack #{:list :vector :seq :sequential :seqable :coll :ifn :associative}
Expand Down
11 changes: 11 additions & 0 deletions test/clj_kondo/types_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,17 @@
(is (empty? (lint! "
(require 'clojure.string)
(clojure.string/replace \"hallo\" \"a\" (first [\"e\"]))
" {:linters {:type-mismatch {:level :error}}})))
(is (empty? (lint! "
(defn transducer []
(fn [rf]
(fn
([] (rf))
([result] (rf result))
([result input]
(rf result input)))))
(into [] (transducer) [1 2 3])
" {:linters {:type-mismatch {:level :error}}}))))

(deftest binding-call-test
Expand Down

0 comments on commit bb12c68

Please sign in to comment.