From 60639facf7d4e266d729a9c89f333618c9b2e8e2 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 8 Aug 2006 14:24:24 +0000 Subject: [PATCH] 0.9.15.15: Fix bug #339c: INVALID-METHOD-ERROR from methods not matching any method group. ... I'm actually not convinced by this fix: I think the method combination itself should probably call I-M-E, rather than have the effective method call it (see CLHS on INVALID-METHOD-ERROR); however, at the moment, given PRECOMPUTE-EFFECTIVE-METHOD's behaviour, this is the only way to signal the error at the right time. Revisit when/if effective-method precomputation is adjusted. --- BUGS | 16 +--------------- NEWS | 11 ++++++++--- src/pcl/defcombin.lisp | 7 ++++++- tests/clos.impure.lisp | 23 +++++++++++++++++++++++ version.lisp-expr | 2 +- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/BUGS b/BUGS index 6e719bc..be6f906 100644 --- a/BUGS +++ b/BUGS @@ -1228,21 +1228,7 @@ WORKAROUND: iii. supplied-p variables for &optional and &key arguments are not bound. - c. qualifier matching incorrect - (progn - (define-method-combination mc27 () - ((normal ()) - (ignored (:ignore :unused))) - `(list 'result - ,@(mapcar #'(lambda (method) `(call-method ,method)) normal))) - (defgeneric test-mc27 (x) - (:method-combination mc27) - (:method :ignore ((x number)) (/ 0))) - (test-mc27 7)) - - should signal an invalid-method-error, as the :IGNORE (NUMBER) - method is applicable, and yet matches neither of the method group - qualifier patterns. + c. (fixed in sbcl-0.9.15.15) 344: more (?) ROOM T problems (possibly part of bug 108) In sbcl-0.8.12.51, and off and on leading up to it, the diff --git a/NEWS b/NEWS index a6b852b..6e3cb20 100644 --- a/NEWS +++ b/NEWS @@ -5,14 +5,19 @@ changes in sbcl-0.9.16 relative to sbcl-0.9.15: as specified by AMOP. * optimization: faster LOGCOUNT implementation on x86 and x86-64 (thanks to Lutz Euler) + * fixed bug #337: use of MAKE-METHOD in method combination now works + even in the presence of user-defined method classes. (reported by + Bruno Haible and Pascal Costanza) + * fixed bug #339(c): if there are applicable methods not part of any + long-form method-combination group, call INVALID-METHOD-ERROR. + (reported by Bruno Haible) * bug fix: improved the handling of type declarations and the detection of violations for keyword arguments with non-constant defaults. - * bug fix: use of MAKE-METHOD in method combination now works even - in the presence of user-defined method classes. (reported by - Bruno Haible and Pascal Costanza) * bug fix: erronous calls to PATHNAME were being optimized away. (reported by Richard Kreuter) + * bug fix: compiled calls to TYPEP were mishandling obsolete + instances. (reported by James Bielman and Attila Lendvai) changes in sbcl-0.9.15 relative to sbcl-0.9.14: * added support for the ucs-2 external format. (contributed by Ivan diff --git a/src/pcl/defcombin.lisp b/src/pcl/defcombin.lisp index 711696f..f3296a9 100644 --- a/src/pcl/defcombin.lisp +++ b/src/pcl/defcombin.lisp @@ -324,7 +324,12 @@ (method-group-specifiers declarations real-body) (let (names specializer-caches cond-clauses required-checks order-cleanups) (let ((nspecifiers (length method-group-specifiers))) - (dolist (method-group-specifier method-group-specifiers) + (dolist (method-group-specifier method-group-specifiers + (push `(t (return-from .long-method-combination-function. + `(invalid-method-error , .method. + "~@"))) + cond-clauses)) (multiple-value-bind (name tests description order required) (parse-method-group-specifier method-group-specifier) (declare (ignore description)) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 27bbf45..f05a40e 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -1346,4 +1346,27 @@ ;;; cache with more than one key, then failure ensues. (reinitialize-instance #'print-object) +;;; bug in long-form method combination: if there's an applicable +;;; method not part of any method group, we need to call +;;; INVALID-METHOD-ERROR. (MC27 test case from Bruno Haible) +(define-method-combination mc27 () + ((normal ()) + (ignored (:ignore :unused))) + `(list 'result + ,@(mapcar #'(lambda (method) `(call-method ,method)) normal))) +(defgeneric test-mc27 (x) + (:method-combination mc27) + (:method :ignore ((x number)) (/ 0))) +(assert (raises-error? (test-mc27 7))) + +(define-method-combination mc27prime () + ((normal ()) + (ignored (:ignore))) + `(list 'result ,@(mapcar (lambda (m) `(call-method ,m)) normal))) +(defgeneric test-mc27prime (x) + (:method-combination mc27prime) + (:method :ignore ((x number)) (/ 0))) +(assert (equal '(result) (test-mc27prime 3))) +(assert (raises-error? (test-mc27 t))) ; still no-applicable-method + ;;;; success diff --git a/version.lisp-expr b/version.lisp-expr index d3a8d88..7c7e6b1 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.9.15.14" +"0.9.15.15" -- 1.7.10.4