X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fclos.impure.lisp;h=f05a40ea3a691d87d44f6ae7fb0dce1e8aeafab1;hb=60639facf7d4e266d729a9c89f333618c9b2e8e2;hp=27bbf453783b67fe5d6b0a29a0f075587f0b12e1;hpb=42938a8cffe21be4b5a50d2253bbe76bab25e16a;p=sbcl.git 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