0.7.2.9:
authorChristophe Rhodes <csr21@cam.ac.uk>
Tue, 9 Apr 2002 11:21:13 +0000 (11:21 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Tue, 9 Apr 2002 11:21:13 +0000 (11:21 +0000)
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
tests/clos.impure.lisp
version.lisp-expr

index 8dd9ea1..37155ae 100644 (file)
         (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."
index 9d43e31..b1dd8c7 100644 (file)
 (defgeneric born-to-be-redefined (x))
 (assert (eq (born-to-be-redefined 1) 'int))
 \f
+;;; 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))))
+\f
 ;;;; success
 
 (sb-ext:quit :unix-status 104)
index d438300..cb24730 100644 (file)
@@ -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"