Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.5, Release 1.4
    • Fix versions: Release 1.5
    • Labels:
      None
    • Approval:
      Ok
    • Patch:
      Code and Test

      Description

      Equality for sets is not consistent with other persistent collections when the hashCode differs:

      (=

      {(Integer. -1) :foo}

      {(Long. -1) :foo}

      )
      => true

      (= [(Integer. -1)] [(Long. -1)])
      => true

      (= #

      {(Integer. -1)}

      #

      {(Long. -1)}

      )
      => false

      Attached is what I believe to be a basic fix. It removes a hashCode check from APersistentSet.equals. A similar check was removed from APersistentMap in the following commit:

      https://github.com/clojure/clojure/commit/b5f5ba2e15dc2f20e14e05141f7de7c6a3d91179

      With this patch, set equality works as expected and all tests pass.

      My understanding of the implications of this change are limited, so someone more knowledgeable would need to chime in about its correctness.

        Attachments

          Activity

            People

            • Assignee:
              aaron Aaron Bedra
              Reporter:
              jkkramer Justin Kramer
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: