equality bug on records created with nested calls to map->record

Description

Depending on the type of the map passed to a record map constructor, records will not correctly compare for equality:

1 2 3 4 5 6 7 8 9 10 11 12 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

Environment

None

Status

Assignee

Unassigned

Reporter

Nicola Mometto

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.6

Priority

Major
Configure