From: Christophe Rhodes <csr21@cam.ac.uk>
Date: Wed, 16 Jun 2004 20:28:45 +0000 (+0000)
Subject: 0.8.11.14:
X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=a2e72ddcfa3308ed7eb02c7b1bdfe3120d71b423;p=sbcl.git

0.8.11.14:
	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.
---

diff --git a/src/compiler/parse-lambda-list.lisp b/src/compiler/parse-lambda-list.lisp
index 5f5bdc0..8760b4e 100644
--- a/src/compiler/parse-lambda-list.lisp
+++ b/src/compiler/parse-lambda-list.lisp
@@ -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
diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp
index e6d6518..ae0fe96 100644
--- a/tests/compiler.pure.lisp
+++ b/tests/compiler.pure.lisp
@@ -1394,3 +1394,22 @@
   (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)))))
diff --git a/version.lisp-expr b/version.lisp-expr
index a8072d3..a1c66db 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.8.11.13"
+"0.8.11.14"