0.8.11.14:
authorChristophe Rhodes <csr21@cam.ac.uk>
Wed, 16 Jun 2004 20:28:45 +0000 (20:28 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Wed, 16 Jun 2004 20:28:45 +0000 (20:28 +0000)
There is no excuse for &OPTIONAL and &KEY arguments in the same
lambda list.  Really not.  (Silly ANSI, silly CLIM)
... STYLE-WARN on function lambda lists with this bogosity;
... tests.

src/compiler/parse-lambda-list.lisp
tests/compiler.pure.lisp
version.lisp-expr

index 5f5bdc0..8760b4e 100644 (file)
@@ -84,6 +84,9 @@
                (unless (member state
                                '(:required :optional :post-rest :post-more))
                  (compiler-error "misplaced &KEY in lambda list: ~S" list))
+              (when (optional)
+                (style-warn
+                 "&OPTIONAL and &KEY found in the same lambda list: ~S" list))
                (setq keyp t
                      state :key))
               (&allow-other-keys
index e6d6518..ae0fe96 100644 (file)
   (frob (x y) (position-if x y))
   (frob (x y) (position-if-not x y))
   (frob (x) (aref x 0)))
+
+(macrolet ((frob (style-warn-p form)
+            (if style-warn-p
+                `(catch :got-style-warning
+                  (handler-case
+                      (eval ',form)
+                    (style-warning (e) (throw :got-style-warning nil)))
+                  (error "missing style-warning for ~S" ',form))
+                `(handler-case
+                  (eval ',form)
+                  (style-warning (e)
+                   (error "bad style-warning for ~S: ~A" ',form e))))))
+  (frob t (lambda (x &optional y &key z) (list x y z)))
+  (frob nil (lambda (x &optional y z) (list x y z)))
+  (frob nil (lambda (x &key y z) (list x y z)))
+  (frob t (defgeneric #:foo (x &optional y &key z)))
+  (frob nil (defgeneric #:foo (x &optional y z)))
+  (frob nil (defgeneric #:foo (x &key y z)))
+  (frob t (defun #:foo (x) (flet ((foo (x &optional y &key z) (list x y z))) (foo x x :z x)))))
index a8072d3..a1c66db 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".)
-"0.8.11.13"
+"0.8.11.14"