Inconsistent hashing of empty collections

Description

I get different results when hashing a literal empty vector than when hashing one from read-string, while all the other collections produce the same hash code:

``` clojure
homepage.core> [(hash [2]) (hash (cljs.reader/read-string "[2]"))]
[-1917711765 -1917711765]
homepage.core> [(hash [0]) (hash (cljs.reader/read-string "[0]"))]
[965192274 965192274]
homepage.core> [(hash []) (hash (cljs.reader/read-string "[]"))]
[0 2017569654] ;; <-- this one looks suspicious.
homepage.core> [(hash {}) (hash (cljs.reader/read-string "{}"))]
[-15128758 -15128758]
homepage.core> [(hash #{}) (hash (cljs.reader/read-string "#{}"))]
[0 0]
homepage.core> clojurescript-version
"0.0-2496"
```

Environment

clojurescript 0.0-2496"
clojure 1.6.0

Attachments

1
  • 06 Jan 2015, 12:34 AM

Activity

Show:

Michał Marczyk January 6, 2015 at 8:55 PM

Thanks for the quick merge!

David Nolen January 6, 2015 at 1:57 PM

Michal, wow thanks for the quick fix!

Michał Marczyk January 6, 2015 at 12:34 AM

Patch with test.

David Nolen January 5, 2015 at 5:24 PM

Seems to be a bug that effects all empty collections, the hash values should match Clojure's.

Completed

Details

Assignee

Reporter

Priority

Created January 5, 2015 at 5:02 PM
Updated January 6, 2015 at 8:55 PM
Resolved January 6, 2015 at 8:55 PM

Flag notifications