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

On empty call, List and PersistentQueue do not retain meta, sorted-set/sorted map do not retain comparator

    Details

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

      Description

      -empty method is implemented incorrectly at List, PersistentQueue, PersistentSortedSet, PersistentSortedMap

      (-> (sorted-set-by (comp - compare))
          empty
          (into [2 3 1])) => #{1 2 3} (should be #{3 2 1})
      
      (-> (sorted-map-by (comp - compare))
          empty
          (into [[2 :b] [3 :c] [1 :a]])) => {1 :a, 2 :b, 3 :c} (should be backwards)
      
      (meta (empty '^{:a 1} (1 2 3))) => nil (should be {:a 1})
      
      (meta (empty (with-meta (.-EMPTY PersistentQueue) {:b :c}))) => nil (should be {:b :c})
      

      Patch with tests attached: cljs-915-fix-empty-on-collections.patch

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tonsky Nikita Prokopov
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: