Skip to content

Commit fb341d3

Browse files
ghadishaybanstuarthalloway
authored andcommitted
CLJ-2580 correct case expr branch analysis
Signed-off-by: Stuart Halloway <stu@cognitect.com>
1 parent f25f3e2 commit fb341d3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/jvm/clojure/lang/Compiler.java

+2
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,8 @@ static Class maybeJavaClass(Collection<Expr> exprs){
13751375
if (!e.hasJavaClass())
13761376
return null;
13771377
Class c = e.getJavaClass();
1378+
if (c == null)
1379+
return null;
13781380
if (match == null)
13791381
match = c;
13801382
else if (match != c)

test/clojure/test_clojure/compilation.clj

+5
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,8 @@
438438
(is (= 42 (compilation.JDK8InterfaceMethods/staticMethod0 42)))
439439
(is (= "test" (compilation.JDK8InterfaceMethods/staticMethod1 "test")))
440440
(is (= 1 (if (compilation.JDK8InterfaceMethods/staticMethod2 true) 1 2)))))
441+
442+
(deftest CLJ-2580
443+
(testing "CLJ-2580 Correctly calculate exit branches of case"
444+
(is (zero? (let [d (case nil :x nil 0)] d)))
445+
(is (nil? (let [d (case nil :x 0 nil)] d)))))

0 commit comments

Comments
 (0)