add &KEY SILENT to PARSE-LAMBDA-LIST
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 14 Jun 2011 09:06:28 +0000 (12:06 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 14 Jun 2011 09:17:15 +0000 (12:17 +0300)
  Passed through to PARSE-LAMBDA-LIST-LIKE, used by %SPLIT-ARGLIST in PCL.

  Prior to this GENERIC-FUNCTION-PRETTY-ARGLIST on functions with both
  &OPTIONAL and &KEY arguments caused a style-warning -- and inquiring about
  the lambda-list isn't the right time for that.

NEWS
src/compiler/parse-lambda-list.lisp
src/pcl/methods.lisp
tests/clos.impure.lisp

diff --git a/NEWS b/NEWS
index 1d7f30a..02b1342 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ changes relative to sbcl-1.0.49:
   * bug fix: FORMAT now handles floating point rounding correct, eg.
     (format nil "~,1F" 0.01) => "0.0" instead of "0.01" as previously.
     (lp#308961)
+  * bug fix: style warning during lambda-list introspection of generic
+    functions with both optional and key argments.
 
 changes in sbcl-1.0.49 relative to sbcl-1.0.48:
   * minor incompatible change: WITH-LOCKED-HASH-TABLE no longer disables
index affb94d..c906093 100644 (file)
@@ -38,7 +38,7 @@
                            (values list list boolean t boolean list boolean
                                    boolean list boolean t t boolean))
                 parse-lambda-list-like-thing))
-(declaim (ftype (sfunction (list)
+(declaim (ftype (sfunction (list &key (:silent boolean))
                            (values list list boolean t boolean list boolean
                                    boolean list boolean t t))
                 parse-lambda-list))
 ;;; can barf on things which're illegal as arguments in lambda lists
 ;;; even if they could conceivably be legal in not-quite-a-lambda-list
 ;;; weirdosities
-(defun parse-lambda-list (lambda-list)
+(defun parse-lambda-list (lambda-list &key silent)
   ;; Classify parameters without checking their validity individually.
   (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux
                         morep more-context more-count)
-      (parse-lambda-list-like-thing lambda-list)
+      (parse-lambda-list-like-thing lambda-list :silent silent)
 
     ;; Check validity of parameters.
     (flet ((need-symbol (x why)
index 13bc885..3c6b614 100644 (file)
   ;; PARSE-LAMBDA-LIST to something handier.
   (multiple-value-bind (required optional restp rest keyp keys allowp
                         auxp aux morep more-context more-count)
-      (parse-lambda-list lambda-list)
+      (parse-lambda-list lambda-list :silent t)
     (declare (ignore restp keyp auxp aux morep))
     (declare (ignore more-context more-count))
     (values required optional rest keys allowp)))
index 56fb8c3..a00da1d 100644 (file)
               (check-type req integer))))
     (assert (= warnings 1))))
 
+(defgeneric generic-function-pretty-arglist-optional-and-key (req &optional opt &key key)
+  (:method (req &optional opt &key key)
+    (list req opt key)))
 
+(with-test (:name :generic-function-pretty-arglist-optional-and-key)
+  (handler-bind ((warning #'error))
+    ;; Used to signal a style-warning
+    (assert (equal '(req &optional opt &key key)
+                   (sb-pcl::generic-function-pretty-arglist
+                    #'generic-function-pretty-arglist-optional-and-key)))))
 
 ;;;; success