From 76874d05d623e0001cfcf23d2c74f78295ba6cee Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Tue, 29 Jun 2004 12:42:52 +0000 Subject: [PATCH] 0.8.12.10: Fix bug 338: "MOP specializers as type specifiers" (reported by Bruno Haible sbcl-devel 2004-06-11) ... Adding a type translator in SHARED-INITIALIZE :AFTER does the trick. ... Test case. --- BUGS | 14 -------------- NEWS | 2 ++ src/pcl/std-class.lisp | 6 +++++- tests/mop.impure.lisp | 7 +++++++ version.lisp-expr | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/BUGS b/BUGS index 66d06c9..51587c4 100644 --- a/BUGS +++ b/BUGS @@ -1540,20 +1540,6 @@ WORKAROUND: (test-um12 17)) fails with NO-APPLICABLE-METHOD. -338: "MOP specializers as type specifiers" - (reported by Bruno Haible sbcl-devel 2004-06-11) - - ANSI 7.6.2 says: - Because every valid parameter specializer is also a valid type - specifier, the function typep can be used during method selection - to determine whether an argument satisfies a parameter - specializer. - - however, SBCL's EQL specializers are not type specifiers: - (defmethod foo ((x (eql 4.0))) 3.0) - (typep 1 (first (sb-pcl:method-specializers *))) - gives an error. - 339: "DEFINE-METHOD-COMBINATION bugs" (reported by Bruno Haible via the clisp test suite) diff --git a/NEWS b/NEWS index 228ba4f..9844abc 100644 --- a/NEWS +++ b/NEWS @@ -2564,6 +2564,8 @@ changes in sbcl-0.8.13 relative to sbcl-0.8.12: enable them. * the SB-SPROF contrib now works on (most) non-x86 architectures. It is known as of this release not to work on the Alpha, however. + * fixed bug #338: instances of EQL-SPECIFIER are now valid type + designators and can hence be used with TYPEP. * fixed bug #333: CHECK-TYPE now ensures that the type error signalled, if any, has the right object to be accessed by TYPE-ERROR-DATUM. (reported by Tony Martinez) diff --git a/src/pcl/std-class.lisp b/src/pcl/std-class.lisp index 46cdf63..76edec5 100644 --- a/src/pcl/std-class.lisp +++ b/src/pcl/std-class.lisp @@ -279,7 +279,11 @@ (defmethod shared-initialize :after ((specl eql-specializer) slot-names &key) (declare (ignore slot-names)) - (setf (slot-value specl 'type) `(eql ,(specializer-object specl)))) + (setf (slot-value specl 'type) + `(eql ,(specializer-object specl))) + (setf (info :type :translator specl) + (constantly (make-member-type :members (list (specializer-object specl)))))) + (defun real-load-defclass (name metaclass-name supers slots other) (let ((res (apply #'ensure-class name :metaclass metaclass-name diff --git a/tests/mop.impure.lisp b/tests/mop.impure.lisp index e3c23f9..f14f7f1 100644 --- a/tests/mop.impure.lisp +++ b/tests/mop.impure.lisp @@ -174,6 +174,13 @@ (xs (class-direct-subclasses x))) (assert (>= (length xs) 1)) (assert (member (find-class 'logical-pathname) xs))) + +;;; BUG 338: "MOP specializers as type specifiers" +;;; (reported by Bruno Haible sbcl-devel 2004-06-11) +(let* ((m (defmethod eql-specialized-method ((x (eql 4.0))) 3.0)) + (spec (first (sb-mop:method-specializers m)))) + (assert (not (typep 1 spec))) + (assert (typep 4.0 spec))) ;;;; success (sb-ext:quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index a7bb022..fb09481 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.8.12.9" +"0.8.12.10" -- 1.7.10.4