Uploaded image for project: 'ClojureScript'
  1. CLJS-962

Inconsistent hashing of empty collections

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Environment:

      clojurescript 0.0-2496"
      clojure 1.6.0

      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"
      ```

        Attachments

          Activity

            People

            • Assignee:
              michalmarczyk Michał Marczyk
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: