Fix probable copy-paste error in list iterator, from end

The following code failed:

     (sb-sequence:with-sequence-iterator-functions
         (next stop value _set _index _copy)
         ('(a b c d) :from-end t)
       (loop until (stop) collect (value) do (next)))

... with the following error:

    The value
      (D)
    is not of type
      NUMBER
    when binding SB-KERNEL::X
       [Condition of type TYPE-ERROR]
This commit is contained in:
Christophe Junke 2018-10-24 16:58:11 +02:00 committed by Stas Boukarev
parent 5b620aad83
commit 5760fe4fc1
2 changed files with 11 additions and 2 deletions

View file

@ -216,8 +216,7 @@
(if (eq iterator list)
*exhausted*
(do* ((cdr list (cdr cdr)))
((eq (cdr cdr) iterator) cdr)))
(1+ iterator))
((eq (cdr cdr) iterator) cdr))))
(lambda (list iterator from-end)
(declare (ignore list from-end))
(cdr iterator)))

View file

@ -85,3 +85,13 @@
(with-test (:name (concatenate :result-type class))
(assert (typep (concatenate (find-class 'extended-sequence) '(1 2) '(3 4))
'extended-sequence)))
(with-test (:name :list-iterator-from-end)
(checked-compile-and-assert
()
`(lambda (x)
(sb-sequence:with-sequence-iterator-functions
(next stop value _set _index _copy)
(x :from-end t)
(loop until (stop) collect (value) do (next))))
(('(a b c d)) '(d c b a) :test #'equal)))