Uploaded image for project: 'Clojure'
  1. CLJ-1898

Inconsistent duplicate check in set/map literals with quoted/unquoted equal constants

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Approval:
      Triaged
    • Patch:
      Code and Test

      Description

      Set and map literals containing the same constant quoted and unquoted, will throw a duplicate key exception in some cases (the correct behaviour), while silently ignore the duplicate in some others.

      user=> #{'1 1}
      #{1}
      user=> #{'[] []}
      IllegalArgumentException Duplicate key: []  clojure.lang.PersistentHashSet.createWithCheck (PersistentHashSet.java:56)
      

      This happens because the compiler assumes that literals that have distinct elements at read-time, will have distinct elements at runtime. This is not true for self-evaluating elements where (quote x) is equal to x

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bronsa Nicola Mometto
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: