1.0.5.17: Top-level DECLARE signals an error
authorChristophe Rhodes <csr21@cantab.net>
Wed, 2 May 2007 10:02:08 +0000 (10:02 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Wed, 2 May 2007 10:02:08 +0000 (10:02 +0000)
... probably the user meant a top-level DECLAIM, but in the
absence of proof an error is a decent choice for undefined
behaviour.

NEWS
src/code/eval.lisp
tests/eval.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 68cde3f..029605f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ changes in sbcl-1.0.6 relative to sbcl-1.0.5:
     a STYLE-WARNING to be signalled (regression from 1.0.4.)
   * bug fix: an asynchronous interrupt could previously leave the
     system running with GC inhibited.
+  * bug fix: a DECLARE form evaluated at top-level now causes an error
+    rather than silently (or verbosely) returning NIL.
 
 changes in sbcl-1.0.5 relative to sbcl-1.0.4:
   * incompatible change: removed writer methods for host-ent-name,
index 406dc09..56ea38c 100644 (file)
   ;; to be careful about not muffling warnings arising from inner
   ;; evaluations/compilations, though [e.g. the ignored variable in
   ;; (DEFUN FOO (X) 1)].  -- CSR, 2003-05-13
-  (let ((fun (sb!c:compile-in-lexenv nil
-                                     `(lambda () ,expr)
-                                     lexenv)))
+  (let* (;; why PROGN?  So that attempts to eval free declarations
+         ;; signal errors rather than return NIL.  -- CSR, 2007-05-01
+         (lambda `(lambda () (progn ,expr)))
+         (fun (sb!c:compile-in-lexenv nil lambda lexenv)))
     (funcall fun)))
 
 ;;; Handle PROGN and implicit PROGN.
index a3db89d..c5de28b 100644 (file)
       (tagbody (go NIL) NIL) t)
     (assert (tagbody-nil-is-valid-tag))))
 
+;;; top-level DECLARE is formally undefined, but we want it to raise
+;;; an error rather than silently return NIL.
+(defvar *scratch*)
+(with-test (:name :toplevel-declare)
+  (assert (raises-error? (eval '(declare (type pathname *scratch*))))))
+
 ;;; success
index fead5e8..a7ced81 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.5.16"
+"1.0.5.17"