0.8.15.4:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 1 Oct 2004 12:35:26 +0000 (12:35 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 1 Oct 2004 12:35:26 +0000 (12:35 +0000)
Fix for method redefinition WARNING (Zach Beane sbcl-devel
2004-09-24)
... slight tweak to get &optional (stream *standard-output*)
right.

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

diff --git a/NEWS b/NEWS
index 3182fb6..7c09acf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 changes in sbcl-0.8.16 relative to sbcl-0.8.15:
   * bug fix: read-write consistency on streams of element-type
     (SIGNED-BYTE N) for N > 32.  (reported by Bruno Haible for CMUCL)
+  * bug fix: redefiniton of the only method of a generic function with
+    no DEFGENERIC no longer emits a full WARNING.  In addition,
+    redefinition of generic functions with no DEFGENERIC to an
+    incompatible lambda list now signals an error.  (thanks to Zach
+    Beane)
   * fixed some bugs revealed by Paul Dietz' test suite:
     ** POSITION on displaced vectors with non-zero displacement
        returns the right answer.
index f141b1d..c82b16d 100644 (file)
@@ -1644,6 +1644,12 @@ bootstrapping.
        (unless (equal ,pos ,valsym)
         (setf ,pos ,valsym)))))
 
+(defun create-gf-lambda-list (lambda-list)
+  ;;; Create a gf lambda list from a method lambda list
+  (loop for x in lambda-list
+        collect (if (consp x) (list (car x)) x)
+        if (eq x '&key) do (loop-finish)))
+
 (defun set-arg-info (gf &key new-method (lambda-list nil lambda-list-p)
                        argument-precedence-order)
   (let* ((arg-info (if (eq *boot-state* 'complete)
@@ -1671,8 +1677,10 @@ bootstrapping.
              (error "The lambda-list ~S is incompatible with ~
                     existing methods of ~S."
                     lambda-list gf))))
-       (when lambda-list-p
-         (esetf (arg-info-lambda-list arg-info) lambda-list))
+        (esetf (arg-info-lambda-list arg-info)
+               (if lambda-list-p
+                   lambda-list
+                   (create-gf-lambda-list lambda-list)))
        (when (or lambda-list-p argument-precedence-order
                  (null (arg-info-precedence arg-info)))
          (esetf (arg-info-precedence arg-info)
@@ -1920,11 +1928,8 @@ bootstrapping.
              (let* ((method (car (last methods)))
                     (ll (if (consp method)
                             (early-method-lambda-list method)
-                            (method-lambda-list method)))
-                    (k (member '&key ll)))
-               (if k
-                   (ldiff ll (cdr k))
-                   ll))))
+                            (method-lambda-list method))))
+                (create-gf-lambda-list ll))))
        (arg-info-lambda-list arg-info))))
 
 (defmacro real-ensure-gf-internal (gf-class all-keys env)
index 629041f..94b3dc5 100644 (file)
 (defmethod incompatible-ll-test-2 ((x integer) &key bar) bar)
 (assert (= (length
            (sb-pcl:generic-function-methods #'incompatible-ll-test-2)) 2))
-(assert (equal (incompatible-ll-test-2 t 1 2) '(1 2)))
+
+;;; Per Christophe, this is an illegal method call because of 7.6.5
+(assert (raises-error? (incompatible-ll-test-2 t 1 2)))
+
 (assert (eq (incompatible-ll-test-2 1 :bar 'yes) 'yes))
+
+(defmethod incompatible-ll-test-3 ((x integer)) x)
+(remove-method #'incompatible-ll-test-3
+               (find-method #'incompatible-ll-test-3
+                            nil
+                            (list (find-class 'integer))))
+(assert (raises-error? (defmethod incompatible-ll-test-3 (x y) (list x y))))
+
 \f
 ;;; Attempting to instantiate classes with forward references in their
 ;;; CPL should signal errors (FIXME: of what type?)
index d1efd9b..169c7d3 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.15.3"
+"0.8.15.4"