private implementation detail, and no longer a semi-private MOP
interface.
* 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)
+ considered to be able to check types of their arguments.
+ (reported by Nathan J. Froyd)
+ * fixed a bug in computing method discriminating functions: it is
+ now possible to define methods specialized on classes which have
+ forward-referenced superclasses. (thanks to Gerd Moellmann)
* fixed some bugs revealed by Paul Dietz' test suite:
** COPY-ALIST now signals an error if its argument is a dotted
list;
((and (eq *boot-state* 'complete)
(compute-applicable-methods-emf-std-p gf))
(let* ((caching-p (use-caching-dfun-p gf))
+ ;; KLUDGE: the only effect of this (when
+ ;; *LAZY-DFUN-COMPUTE-P* is true, as it usually is)
+ ;; is to signal an error when we try to add methods
+ ;; with the wrong qualifiers to a generic function.
(classes-list (precompute-effective-methods
gf caching-p
(not *lazy-dfun-compute-p*))))
(mapcar (lambda (x) (position x lambda-list))
argument-precedence-order)))
+(defun cpl-or-nil (class)
+ (if (eq *boot-state* 'complete)
+ (when (class-finalized-p class)
+ (class-precedence-list class))
+ (early-class-precedence-list class)))
+
(defun saut-and (specl type)
(let ((applicable nil)
(possibly-applicable t))
(defun saut-not-class (specl ntype)
(let* ((class (type-class specl))
- (cpl (class-precedence-list class)))
- (not (memq (cadr ntype) cpl))))
+ (cpl (cpl-or-nil class)))
+ (not (memq (cadr ntype) cpl))))
(defun saut-not-prototype (specl ntype)
(let* ((class (case (car specl)
(class-eq (cadr specl))
(prototype (cadr specl))
(class (cadr specl))))
- (cpl (class-precedence-list class)))
- (not (memq (cadr ntype) cpl))))
+ (cpl (cpl-or-nil class)))
+ (not (memq (cadr ntype) cpl))))
(defun saut-not-class-eq (specl ntype)
(let ((class (case (car specl)
(t t)))
(defun class-applicable-using-class-p (specl type)
- (let ((pred (memq specl (if (eq *boot-state* 'complete)
- (class-precedence-list type)
- (early-class-precedence-list type)))))
+ (let ((pred (memq specl (cpl-or-nil type))))
(values pred
(or pred
(if (not *in-precompute-effective-methods-p*)
(class (class-applicable-using-class-p (cadr specl) (cadr type)))
(t (values nil (let ((class (type-class specl)))
(memq (cadr type)
- (class-precedence-list class)))))))
+ (cpl-or-nil class)))))))
(defun saut-class-eq (specl type)
(if (eq (car specl) 'eql)
(assert (= (class-allocation-reader) 4))
\f
;;; from James Anderson via Gerd Moellmann: defining methods with
-;;; forward-referenced specializers used not to work (FIXME: and also
-;;; calling said method with an instance of something else
-;;; [SPECIALIZER1, here] should work -- patch forthcoming)
+;;; specializers with forward-referenced superclasses used not to
+;;; work.
(defclass specializer1 () ())
(defclass specializer2 (forward-ref1) ())
(defmethod baz ((x specializer2)) x)
(defmethod baz ((x specializer1)) x)
+(assert (typep (baz (make-instance 'specializer1)) 'specializer1))
\f
;;; success
(sb-ext:quit :unix-status 104)
\ No newline at end of file