From 549e2fd473ebcccd557ab17f1cf780b40bf0f2be Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Wed, 30 Oct 2002 16:20:00 +0000 Subject: [PATCH] 0.7.9.18: DEFINE-METHOD-COMBINATION should return the name of the method combination, not some method. Make it so. --- src/pcl/defcombin.lisp | 6 ++++-- tests/clos.impure.lisp | 21 +++++++++++++++++++++ version.lisp-expr | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/pcl/defcombin.lisp b/src/pcl/defcombin.lisp index 97472ca..56d0759 100644 --- a/src/pcl/defcombin.lisp +++ b/src/pcl/defcombin.lisp @@ -98,7 +98,8 @@ :definition-source `((define-method-combination ,type) ,pathname))) (when old-method (remove-method #'find-method-combination old-method)) - (add-method #'find-method-combination new-method))) + (add-method #'find-method-combination new-method) + type)) (defun short-combine-methods (type options operator ioa method doc) (cond ((null options) (setq options '(:most-specific-first))) @@ -218,7 +219,8 @@ ,*load-pathname*)))) (setf (gethash type *long-method-combination-functions*) function) (when old-method (remove-method #'find-method-combination old-method)) - (add-method #'find-method-combination new-method))) + (add-method #'find-method-combination new-method) + type)) (defmethod compute-effective-method ((generic-function generic-function) (combin long-method-combination) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index b4462cd..cad0723 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -365,6 +365,27 @@ k) (dmc-test-mc :k 1) +;;; While I'm at it, DEFINE-METHOD-COMBINATION is defined to return +;;; the NAME argument, not some random method object. So: +(assert (eq (define-method-combination dmc-test-return-foo) + 'dmc-test-return-foo)) +(assert (eq (define-method-combination dmc-test-return-bar :operator and) + 'dmc-test-return-bar)) +(assert (eq (define-method-combination dmc-test-return + (&optional (order :most-specific-first)) + ((around (:around)) + (primary (dmc-test-return) :order order :required t)) + (let ((form (if (rest primary) + `(and ,@(mapcar #'(lambda (method) + `(call-method ,method)) + primary)) + `(call-method ,(first primary))))) + (if around + `(call-method ,(first around) + (,@(rest around) + (make-method ,form))) + form))) + 'dmc-test-return)) ;;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 4308737..4c8916b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.9.17" +"0.7.9.18" -- 1.7.10.4