Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: Release 1.6
-
Fix Version/s: Release 1.7
-
Component/s: None
-
Labels:
-
Patch:Code and Test
-
Approval:Ok
Description
Depending on the type of the map passed to a record map constructor, records will not correctly compare for equality:
user> (defrecord a []) user.a user> (def r1 (map->a {:a 1})) nil user> (def r2 (map->a r1)) nil user> (= r1 r2) ;; expected => true false user> (.__extmap r1) {:a 1} user> (.__extmap r2) ;; expected => {:a 1} #user.a{:a 1}
Cause: The type of the map passed into the map constructor leaks into the __extmap, affecting equality comparison of the record. This bug was described in this post: https://groups.google.com/forum/#!topic/clojure/iN-SPBaTFUw
Approach: Clean the extmap before putting it into the record constructor.
Patch: CLJ-1388-record-equality-and-map-record-factory.patch
Screened by: Alex Miller
Thanks for the clarification Andy. As I mentioned my post may be irrelevant.
I just saw this while scanning the 1.7 changes and figured I'd mention in case there was any more circling back to this (if the patch that was applied proved unsuccessful, etc).