From: Christophe Rhodes Date: Tue, 25 Mar 2003 12:34:32 +0000 (+0000) Subject: 0.pre8.6: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b3a419f10ad442a1c59d51edabdc70518f193648;p=sbcl.git 0.pre8.6: Fix COPY-ALIST bug ... required to signal a type error on dotted lists. --- diff --git a/NEWS b/NEWS index 315d5c8..f3bbed6 100644 --- a/NEWS +++ b/NEWS @@ -1626,6 +1626,9 @@ changes in sbcl-0.8.0 relative to sbcl-0.7.14 * known functions, which cannot be open coded by backend, are considered to be able to check types of their arguments. (reported by Nathan J. Froyd) + * fixed some bugs revealed by Paul Dietz' test suite: + ** COPY-ALIST now signals an error if its argument is a dotted + list; planned incompatible changes in 0.7.x: * (not done yet, but planned:) When the profiling interface settles diff --git a/src/code/list.lisp b/src/code/list.lisp index 762561c..2353c5a 100644 --- a/src/code/list.lisp +++ b/src/code/list.lisp @@ -301,7 +301,7 @@ (let ((result (list (car list)))) (do ((x (cdr list) (cdr x)) (splice result - (cdr (rplacd splice (cons (car x) '() ))) )) + (cdr (rplacd splice (cons (car x) '()))))) ((atom x) (unless (null x) (rplacd splice x)))) @@ -310,12 +310,12 @@ (defun copy-alist (alist) #!+sb-doc "Return a new association list which is EQUAL to ALIST." - (if (atom alist) + (if (endp alist) alist (let ((result (cons (if (atom (car alist)) (car alist) - (cons (caar alist) (cdar alist)) ) + (cons (caar alist) (cdar alist))) nil))) (do ((x (cdr alist) (cdr x)) (splice result @@ -325,10 +325,7 @@ (car x) (cons (caar x) (cdar x))) nil))))) - ;; Non-null terminated alist done here. - ((atom x) - (unless (null x) - (rplacd splice x)))) + ((endp x))) result))) (defun copy-tree (object) diff --git a/tests/list.pure.lisp b/tests/list.pure.lisp index c450c9f..00dc793 100644 --- a/tests/list.pure.lisp +++ b/tests/list.pure.lisp @@ -106,5 +106,7 @@ (append nil (1 2) nil (3 . 4) nil) (reverse (1 2 . 3)) (nreverse (1 2 . 3)) - (nreconc (1 2 . 3) (4 5)))) - (assert (raises-error? (apply (first test) (copy-tree (rest test))) type-error))) + (nreconc (1 2 . 3) (4 5)) + (copy-alist ((1 . 2) (3 . 4) . 5)))) + (assert (raises-error? (apply (first test) (copy-tree (rest test))) + type-error))) diff --git a/version.lisp-expr b/version.lisp-expr index 866e826..3ef0e85 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.pre8.5" +"0.pre8.6"