0.9.14.12:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 13 Jul 2006 10:03:38 +0000 (10:03 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 13 Jul 2006 10:03:38 +0000 (10:03 +0000)
Fix bug in SB-PCL::COMPUTE-CLASS-SLOTS, exposed by CHANGE-CLASS.
... test case
... this bug fix means that we no longer have to walk the
inherits vector looking for class slots from
superclasses, hooray.

NEWS
src/pcl/std-class.lisp
tests/clos.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index eed5f25..7019aba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,16 @@
 ;;;; -*- coding: utf-8; -*-
 changes in sbcl-0.9.15 relative to sbcl-0.9.14:
-  * added support for the ucs-2 external format (contributed by Ivan     Boldyrev)
+  * added support for the ucs-2 external format.  (contributed by Ivan
+    Boldyrev)
   * minor incompatible change: pretty printing of objects of type
     (cons symbol) is, in the default pprint-dispatch-table, now
     sensitive to whether the symbol satisfies FBOUNDP.  (thanks to
     Marcus Pearce)
   * fixed bug: FILE-POSITION sometimes returned inconsistent results
-    for multibyte external-format streams (thanks to "vbzoli")
+    for multibyte external-format streams.  (thanks to "vbzoli")
+  * fixed bug: CHANGE-CLASS would fail to preserve the values of slots
+    with :ALLOCATION :CLASS inherited from superclasses of the
+    original class.
 
 changes in sbcl-0.9.14 relative to sbcl-0.9.13:
   * feature: thread support on Solaris/x86, and experimental thread support
index c3216ba..80f7719 100644 (file)
 
 (defun compute-class-slots (eslotds)
   (let (collect)
-    (dolist (eslotd eslotds)
-      (push (assoc (slot-definition-name eslotd)
-                   (class-slot-cells (slot-definition-class eslotd)))
-            collect))
-    (nreverse collect)))
+    (dolist (eslotd eslotds (nreverse collect))
+      (let ((cell (assoc (slot-definition-name eslotd)
+                         (class-slot-cells
+                          (slot-definition-allocation-class eslotd)))))
+        (aver cell)
+        (push cell collect)))))
 
 (defun update-gfs-of-class (class)
   (when (and (class-finalized-p class)
         ;;  --    --> local     add slot
         ;;  --    --> shared    --
 
-        ;; Collect class slots from inherited wrappers. Needed for
-        ;; shared -> local transfers of inherited slots.
-        (let ((inherited (layout-inherits owrapper)))
-          (loop for i from (1- (length inherited)) downto 0
-                for layout = (aref inherited i)
-                when (typep layout 'wrapper)
-                do (dolist (slot (wrapper-class-slots layout))
-                     (pushnew slot oclass-slots :key #'car))))
-
         ;; Go through all the old local slots.
         (let ((opos 0))
           (dolist (name olayout)
index 46749be..864e0b6 100644 (file)
                          (defmethod class-as-specializer-test2 ((x ,(find-class 'class-as-specializer-test)))
                            'bar))))
 (assert (eq 'bar (class-as-specializer-test2 (make-instance 'class-as-specializer-test))))
-
+\f
+;;; CHANGE-CLASS and tricky allocation.
+(defclass foo ()
+  ((a :allocation :class :initform 1)))
+(defclass bar (foo) ())
+(defvar *bar* (make-instance 'bar))
+(defclass baz ()
+  ((a :allocation :instance :initform 2)))
+(change-class *bar* 'baz)
+(assert (= (slot-value *bar* 'a) 1))
 \f
 ;;;; success
index 9e0d5c3..7d1ce15 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.14.11"
+"0.9.14.12"