1.0.31.6: better error reporting for bogus parameter specializer names
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Sep 2009 06:40:03 +0000 (06:40 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Sep 2009 06:40:03 +0000 (06:40 +0000)
  https://bugs.launchpad.net/sbcl/+bug/414788

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

diff --git a/NEWS b/NEWS
index b7294c6..b8a9c2b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ changes relative to sbcl-1.0.31
   * bug fix: (SETF SLOT-VALUE) signalled a warning which should have been
     an optimization note instead. (reported by Martin Cracauer)
   * bug fix: WITH-SLOTS did not work with THE forms. (thanks to David Tolpin)
+  * improvement: better error signalling for bogus parameter specializer names
+    in DEFMETHOD forms (reported by Pluijzer)
 
 changes in sbcl-1.0.31 relative to sbcl-1.0.30:
   * improvement: stack allocation is should now be possible in all nested
index 8deb6c8..11dfa03 100644 (file)
@@ -760,9 +760,15 @@ bootstrapping.
              ((symbolp name) `(find-class ',name))
              ((consp name) (ecase (car name)
                              ((eql) `(intern-eql-specializer ,(cadr name)))
-                             ((class-eq) `(class-eq-specializer (find-class ',(cadr name))))
-                             ((prototype) `(fixme))))
-             (t (bug "Foo")))))
+                             ((class-eq) `(class-eq-specializer (find-class ',(cadr name))))))
+             (t
+              ;; FIXME: Document CLASS-EQ specializers.
+              (error 'simple-reference-error
+                     :format-control
+                     "~@<~S is not a valid parameter specializer name.~@:>"
+                     :format-arguments (list name)
+                     :references (list '(:ansi-cl :macro defmethod)
+                                       '(:ansi-cl :glossary "parameter specializer name")))))))
     `(list ,@(mapcar #'parse specializer-names))))
 
 (unless (fboundp 'make-method-specializers-form)
index 4b0f1db..2c1f50e 100644 (file)
   (assert (eq :defined-method
               (sb-int:info :function
                            :where-from 'i-dont-want-to-be-clobbered-2))))
+
+(with-test (:name :bogus-parameter-specializer-name-error)
+  (assert (eq :ok
+              (handler-case
+                  (eval `(defmethod #:fii ((x "a string")) 'string))
+                (sb-int:reference-condition (c)
+                  (when (member '(:ansi-cl :macro defmethod)
+                                (sb-int:reference-condition-references c)
+                                :test #'equal)
+                    :ok))))))
 \f
 ;;;; success
index 34e433e..901f8dc 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".)
-"1.0.31.5"
+"1.0.31.6"