make ENSURE-GENERIC-FUNCTION accept method combination arguments
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 20 May 2012 17:11:29 +0000 (20:11 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 21 May 2012 05:43:11 +0000 (08:43 +0300)
  Previously we only accepted a list designating the method combination, but
  since MOP also specifies a way to grab the actual method combination, we
  should really accept that as well.

  Fixes bug 936513.

NEWS
src/pcl/boot.lisp
tests/mop.pure.lisp

diff --git a/NEWS b/NEWS
index 04059a8..a3a9a69 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ changes relative to sbcl-1.0.57:
     properly.
   * bug fix: functions from EVAL are now on more equal footing with functions
     from COMPILE. (lp#1000783, lp#851170, lp#922408)
+  * bug fix: ENSURE-GENERIC-METHOD-COMBINATION accepts method combination
+    objects as its :METHOD-COMBINATION argument, not just lists designating
+    method combinations. (lp#936513)
 
 changes in sbcl-1.0.57 relative to sbcl-1.0.56:
   * RANDOM enhancements and bug fixes:
index 1e1518a..7189a53 100644 (file)
@@ -2199,12 +2199,14 @@ bootstrapping.
            (finalize-inheritance ,gf-class)))
      (remf ,all-keys :generic-function-class)
      (remf ,all-keys :environment)
-     (let ((combin (getf ,all-keys :method-combination '.shes-not-there.)))
-       (unless (eq combin '.shes-not-there.)
-         (setf (getf ,all-keys :method-combination)
-               (find-method-combination (class-prototype ,gf-class)
-                                        (car combin)
-                                        (cdr combin)))))
+     (let ((combin (getf ,all-keys :method-combination)))
+       (etypecase combin
+         (cons
+          (setf (getf ,all-keys :method-combination)
+                (find-method-combination (class-prototype ,gf-class)
+                                         (car combin)
+                                         (cdr combin))))
+         ((or null method-combination))))
     (let ((method-class (getf ,all-keys :method-class '.shes-not-there.)))
       (unless (eq method-class '.shes-not-there.)
         (setf (getf ,all-keys :method-class)
index cb60b25..b35f47d 100644 (file)
                (sb-mop:class-direct-superclasses (make-instance 'standard-class))))
 (assert (equal (list (find-class 'sb-mop:funcallable-standard-object))
                (sb-mop:class-direct-superclasses (make-instance 'sb-mop:funcallable-standard-class))))
+
+(with-test (:name :bug-936513)
+  ;; This used to fail as ENSURE-GENERIC-FUNCTION wanted a list specifying
+  ;; the method combination, and didn't accept the actual object
+  (let ((mc (sb-pcl:find-method-combination #'make-instance 'standard nil)))
+    (ensure-generic-function 'make-instance :method-combination mc))
+  ;; Let's make sure the list works too...
+  (ensure-generic-function 'make-instance :method-combination '(standard)))