Skip to content

Commit bbea352

Browse files
puredangerstuarthalloway
authored andcommitted
CLJ-1849 Add tests for CLJ-1846 and CLJ-1825
Signed-off-by: Stuart Halloway <stu@cognitect.com>
1 parent 7faeb3a commit bbea352

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/clojure/test_clojure/compilation.clj

+14
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,17 @@
362362
(try
363363
(finally
364364
(let [z# y#])))))))
365+
366+
;; See CLJ-1846
367+
(deftest incorrect-primitive-type-hint-throws
368+
;; invalid primitive type hint
369+
(is (thrown-with-msg? Compiler$CompilerException #"Cannot coerce long to int"
370+
(load-string "(defn returns-long ^long [] 1) (Integer/bitCount ^int (returns-long))")))
371+
;; correct casting instead
372+
(is (= 1 (load-string "(defn returns-long ^long [] 1) (Integer/bitCount (int (returns-long)))"))))
373+
374+
;; See CLJ-1825
375+
(def zf (fn rf [x] (lazy-seq (cons x (rf x)))))
376+
(deftest test-anon-recursive-fn
377+
(is (= [0 0] (take 2 ((fn rf [x] (lazy-seq (cons x (rf x)))) 0))))
378+
(is (= [0 0] (take 2 (zf 0)))))

0 commit comments

Comments
 (0)