Skip to content

Commit 9923fad

Browse files
committed
CLJS-2832: Bad code gen for ((not empty?) "foo") when compiled with no optimizations
1 parent cbb4896 commit 9923fad

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/clojure/cljs/compiler.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@
11571157
(emit-wrap env
11581158
(cond
11591159
opt-not?
1160-
(emits "!(" (first args) ")")
1160+
(emits "(!(" (first args) "))")
11611161

11621162
proto?
11631163
(let [pimpl (str (munge (protocol-prefix protocol))

src/test/cljs/cljs/core_test.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,3 +1619,9 @@
16191619
(= 1
16201620
(let [a #js {:b 1}]
16211621
((fn [] a.b))))))
1622+
1623+
(deftest test-cljs-2832
1624+
(is (true? ((comp not empty?) "foo")))
1625+
(is (false? ((comp not empty?) "")))
1626+
(is (thrown? js/Error ((not empty?) "foo")))
1627+
(is (thrown? js/Error ((not empty?) ""))))

0 commit comments

Comments
 (0)