From 138ba28006d97560d270d8da3cf3c99012e9053d Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 9 Apr 2002 11:21:13 +0000 Subject: [PATCH] 0.7.2.9: Patch from CSR Forward class (?) bug sbcl-devel 2002-04-08 ... change-class should also now work again. ... regression tests included --- src/pcl/std-class.lisp | 3 ++- tests/clos.impure.lisp | 25 +++++++++++++++++++++++++ version.lisp-expr | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/pcl/std-class.lisp b/src/pcl/std-class.lisp index 8dd9ea1..37155ae 100644 --- a/src/pcl/std-class.lisp +++ b/src/pcl/std-class.lisp @@ -1181,7 +1181,8 @@ (let ((old-position (posq new-slot old-layout))) (when old-position (setf (clos-slots-ref new-slots new-position) - (clos-slots-ref old-slots old-position)))))) + (clos-slots-ref old-slots old-position)))) + (incf new-position))) ;; "The values of slots specified as shared in the class CFROM and ;; as local in the class CTO are retained." diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 9d43e31..b1dd8c7 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -115,6 +115,31 @@ (defgeneric born-to-be-redefined (x)) (assert (eq (born-to-be-redefined 1) 'int)) +;;; in the removal of ITERATE from SB-PCL, a bug was introduced +;;; preventing forward-references and also change-class (which +;;; forward-references used interally) from working properly. One +;;; symptom was reported by Brian Spilsbury (sbcl-devel 2002-04-08), +;;; and another on IRC by Dan Barlow simultaneously. Better check +;;; that it doesn't happen again. +;;; +;;; First, the forward references: +(defclass a (b) ()) +(defclass b () ()) +;;; Then change-class +(defclass class-with-slots () + ((a-slot :initarg :a-slot :accessor a-slot) + (b-slot :initarg :b-slot :accessor b-slot) + (c-slot :initarg :c-slot :accessor c-slot))) + +(let ((foo (make-instance 'class-with-slots + :a-slot 1 + :b-slot 2 + :c-slot 3))) + (let ((bar (change-class foo 'class-with-slots))) + (assert (= (a-slot bar) 1)) + (assert (= (b-slot bar) 2)) + (assert (= (c-slot bar) 3)))) + ;;;; success (sb-ext:quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index d438300..cb24730 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.2.8" +"0.7.2.9" -- 1.7.10.4