In 1.5.1 (anywhere before the
CLJ-1118 patch), this is the behavior on BigDecimal case matching:
In 1.6 the behavior (post
CLJ-1118 patch) has changed:
In 1.6 after
CLJ-1118, I expect to see: ("Long" "BigDecimal" "BigDecimal") as they now have the same hash and hasheq.
Cause: The case constants are hashed in the clojure.core/case macro using clojure.core/hash which calls clojure.lang.util/hasheq(). In Compiler.emitExprForHashes(), a call to clojure.lang.Util/hash(). In Clojure 1.5 these hash values are the same (hash of 1.0M == hasheq of 1.0M == 311). In Clojure 1.6, they are different (hash of 1.0M = 311, hasheq of 1.0M = 31).
In any cases where Java's hashCode and Clojure's hasheq return different values, the case statement can fail to do the correct thing.
Approach: Change Compiler.java to use clojure.lang.Util hasheq() to match the case macro use of clojure.core/hash (which calls clojure.lang.Util.hasheq()).