From 654f7a98d58e1b35def8ccef056f650ea4a3e70b Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 30 Dec 2015 12:23:57 +0300 Subject: [PATCH] Don't ignore invalid COND clauses following a T clause. (cond (t 10) 20) was accepted and returned 10. --- src/code/defboot.lisp | 7 ++----- tests/compiler.pure.lisp | 5 +++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/code/defboot.lisp b/src/code/defboot.lisp index bd08a7ca1..3e8ad92ac 100644 --- a/src/code/defboot.lisp +++ b/src/code/defboot.lisp @@ -85,13 +85,10 @@ (if ,n-result ,n-result (cond ,@more)))) - (if (eq t test) + (if (and (eq test t) + (not more)) ;; THE to preserve non-toplevelness for FOO in ;; (COND (T (FOO))) - ;; FIXME: this hides all other possible stylistic issues, - ;; not the least of which is a code deletion note, - ;; if there are forms following the one whose head is T. - ;; This is not usually the SBCL preferred way. `(the t (progn ,@forms)) `(if ,test (progn ,@forms) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 30fed6adc..3c7dab349 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -5736,3 +5736,8 @@ :skipped-on '(not :64-bit)) (checked-compile `(lambda () (make-list (expt 2 30) :initial-element 0)))) + +(with-test (:name :bad-cond) + (assert-error + (checked-compile + '(lambda () (cond (t 10) 20))))) -- 2.11.4.GIT