0.8.12.10: Fix bug 338: "MOP specializers as type specifiers"
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 29 Jun 2004 12:42:52 +0000 (12:42 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 29 Jun 2004 12:42:52 +0000 (12:42 +0000)
           (reported by Bruno Haible sbcl-devel 2004-06-11)
           ... Adding a type translator in SHARED-INITIALIZE :AFTER
                 does the trick.
           ... Test case.

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

diff --git a/BUGS b/BUGS
index 66d06c9..51587c4 100644 (file)
--- 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 (file)
--- 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)
index 46cdf63..76edec5 100644 (file)
 
 (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))))))
+
 \f
 (defun real-load-defclass (name metaclass-name supers slots other)
   (let ((res (apply #'ensure-class name :metaclass metaclass-name
index e3c23f9..f14f7f1 100644 (file)
        (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)))
 \f
 ;;;; success
 (sb-ext:quit :unix-status 104)
index a7bb022..fb09481 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.8.12.9"
+"0.8.12.10"