From: Christophe Rhodes Date: Wed, 2 May 2007 10:02:08 +0000 (+0000) Subject: 1.0.5.17: Top-level DECLARE signals an error X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=0371580437ef7f3e39f0bfbb9e45264986408b19;p=sbcl.git 1.0.5.17: Top-level DECLARE signals an error ... probably the user meant a top-level DECLAIM, but in the absence of proof an error is a decent choice for undefined behaviour. --- diff --git a/NEWS b/NEWS index 68cde3f..029605f 100644 --- 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, diff --git a/src/code/eval.lisp b/src/code/eval.lisp index 406dc09..56ea38c 100644 --- a/src/code/eval.lisp +++ b/src/code/eval.lisp @@ -20,9 +20,10 @@ ;; 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. diff --git a/tests/eval.impure.lisp b/tests/eval.impure.lisp index a3db89d..c5de28b 100644 --- a/tests/eval.impure.lisp +++ b/tests/eval.impure.lisp @@ -220,4 +220,10 @@ (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 diff --git a/version.lisp-expr b/version.lisp-expr index fead5e8..a7ced81 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".) -"1.0.5.16" +"1.0.5.17"