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

PersistentList/creator doesn't handle ArraySeqs correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: Release 1.7
    • Labels:
    • Approval:
      Ok
    • Patch:
      Code and Test

      Description

      This should return '(2 3) but returns '(1 2 3) instead:

      user=> ((fn [& args] (apply (fn [a & b] (println a b) (apply list b)) args)) 1 2 3)
      1 (2 3)
      (1 2 3)
      

      Note that using vector rather than list returns the correct values:

      user=> ((fn [& args] (apply (fn [a & b] (println a b) (apply vector b)) args)) 1 2 3)
      1 (2 3)
      [2 3]
      

      The bug was reported in this stackoverflow question: https://stackoverflow.com/questions/27819418/strange-behaviour-of-clojure-trampoline and the bug identified in this comment: https://stackoverflow.com/questions/27819418/strange-behaviour-of-clojure-trampoline#comments-27821793

      A simpler example of this bug:

       
      user=> (apply list (next (clojure.lang.ArraySeq/create (object-array [1 2 3]))))
      (1 2 3)
      

      Patch: CLJ-1633-v3.patch

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: