Maciej Katafiasz)
* bug fix: sb-aclrepl now correctly understands how to inspect
single-floats on 64-bit platforms where single-floats are not boxed.
+ * bug fix: SB-MOP:CLASS-SLOTS now signals an error if the class has not
+ yet been finalized. (reported by Levente Meszaros)
* DESCRIBE and (DOCUMENTATION ... 'OPTIMIZE) describe meaning of
SBCL-specific optimize qualities.
"INTERPRETED-PROGRAM-ERROR"
"SIMPLE-CONTROL-ERROR" "SIMPLE-FILE-ERROR"
"SIMPLE-PARSE-ERROR" "SIMPLE-PROGRAM-ERROR"
- "SIMPLE-READER-ERROR" "SIMPLE-READER-PACKAGE-ERROR"
+ "SIMPLE-READER-ERROR"
+ "SIMPLE-READER-PACKAGE-ERROR"
+ "SIMPLE-REFERENCE-CONDITION"
"SIMPLE-STREAM-ERROR"
"SIMPLE-STORAGE-CONDITION"
"SIMPLE-STYLE-WARNING"
(unless (null (cdr rs))
(terpri s)))))))
+(define-condition simple-reference-error (reference-condition simple-error)
+ ())
+
(define-condition duplicate-definition (reference-condition warning)
((name :initarg :name :reader duplicate-definition-name))
(:report (lambda (c s)
(writer (cadr specializers))))
(specl-cpl (if early-p
(early-class-precedence-list specl)
- (and (class-finalized-p specl)
- (class-precedence-list specl))))
+ (when (class-finalized-p specl)
+ (class-precedence-list specl))))
(so-p (member *the-class-standard-object* specl-cpl))
(slot-name (if (consp method)
(and (early-method-standard-accessor-p method)
;; all of its subclasses. If either SPECL or one of the subclasses
;; is not a standard-class, bail out.
(labels ((aux (class)
- ;; FIND-SLOT-DEFINITION might not be defined yet
- (let ((slotd (find-if (lambda (x)
- (eq (sb-pcl::slot-definition-name x)
- slot-name))
- (sb-pcl::class-slots class))))
+ (let ((slotd (find-slot-definition class slot-name)))
(when slotd
- (unless (or early-p
- (slot-accessor-std-p slotd type))
+ (unless (or early-p (slot-accessor-std-p slotd type))
(return-from make-accessor-table nil))
(push (cons specl slotd) (gethash class table))))
(dolist (subclass (sb-pcl::class-direct-subclasses class))
+ (unless (class-finalized-p subclass)
+ (return-from make-accessor-table nil))
(aux subclass))))
(aux specl))))
(maphash (lambda (class specl+slotd-list)
(declare (ignore initargs))
(error "Cannot allocate an instance of ~S." class)) ; So sayeth AMOP
+;;; AMOP says that CLASS-SLOTS signals an error for unfinalized classes.
+(defmethod class-slots :before ((class slot-class))
+ (unless (class-finalized-p class)
+ (error 'simple-reference-error
+ :format-control "~S called on ~S, which is not yet finalized."
+ :format-arguments (list 'class-slots class)
+ :references (list '(:amop :generic-function class-slots)))))
type gf)
(let* ((name (slot-value slotd 'name))
(class (slot-value slotd '%class))
- (old-slotd (find-slot-definition class name))
+ (old-slotd (when (class-finalized-p class)
+ (find-slot-definition class name)))
(old-std-p (and old-slotd (slot-accessor-std-p old-slotd 'all))))
(multiple-value-bind (function std-p)
(if (eq *boot-state* 'complete)
(backtrace (member (caar frame-specs) full-backtrace
:key #'car
:test #'equal)))
-
+
(setf result condition)
(unless backtrace
- (format t "~&//~S not in backtrace:~% ~S~%"
+ (format t "~&//~S not in backtrace:~% ~S~%"
(caar frame-specs)
full-backtrace)
(setf result nil))
:metaclass 'funcallable-standard-class)
(assert (eq (class-of (find-class 'better-be-standard-class))
(find-class 'standard-class)))
+
+;;; CLASS-SLOTS should signal an error for classes that are not yet
+;;; finalized. Reported by Levente Meszaros on sbcl-devel.
+(defclass has-slots-but-isnt-finalized () (a b c))
+(let ((class (find-class 'has-slots-but-isnt-finalized)))
+ (assert (not (sb-mop:class-finalized-p class)))
+ (assert (raises-error? (sb-mop:class-slots class))))
\f
;;;; success
;;; 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".)
-"1.0.13.39"
+"1.0.13.40"