From 295fdbaa30b57128da30e1e5fb0c653dd20f46d1 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 1 Dec 2011 21:05:43 +0200 Subject: [PATCH] don't simplify (LET () ..) => (LOCALLY ...) in the simple evalutor If LET is at toplevel its subforms are not. If LOCALLY is at toplevel its subforms are also at toplevel. --- NEWS | 2 ++ src/code/eval.lisp | 5 +---- tests/eval.impure.lisp | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 8c3eecb..a69f353 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,8 @@ changes relative to sbcl-1.0.54: * bug fix: bogus style-warnings for DEFMETHOD forms that both declared some required arguments ignored and performed assignments to others. (lp#898331) + * bug fix: *EVALUATOR-MODE* :COMPILE treated (LET () ...) identically + to (LOCALLY ...) leading to internally inconsistent toplevel-formness. changes in sbcl-1.0.54 relative to sbcl-1.0.53: * minor incompatible changes: diff --git a/src/code/eval.lisp b/src/code/eval.lisp index 4687ebd..dc74c2c 100644 --- a/src/code/eval.lisp +++ b/src/code/eval.lisp @@ -275,10 +275,7 @@ else) lexenv))) ((let let*) - (destructuring-bind (definitions &rest body) (rest exp) - (if (null definitions) - (simple-eval-locally `(locally ,@body) lexenv) - (%simple-eval exp lexenv)))) + (%simple-eval exp lexenv)) (t (if (and (symbolp name) (eq (info :function :kind name) :function)) diff --git a/tests/eval.impure.lisp b/tests/eval.impure.lisp index 6afd64c..0baf4e9 100644 --- a/tests/eval.impure.lisp +++ b/tests/eval.impure.lisp @@ -262,4 +262,23 @@ (with-input-from-string (s noise) (assert (equal "; in: DEFUN SOURCE-CONTEXT-TEST" (read-line s)))))) +(with-test (:name (eval :empty-let-is-not-toplevel)) + (let ((sb-ext:*evaluator-mode* :compile)) + (eval `(let () + (defmacro empty-let-is-not-toplevel-x () :macro) + (defun empty-let-is-not-toplevel-fun () + (empty-let-is-not-toplevel-x)))) + (eval `(defun empty-let-is-not-toplevel-x () :fun)) + (assert (eq :fun (empty-let-is-not-toplevel-fun)))) + ;; While at it, test that we get the late binding under + ;; interpreter mode. + (let ((sb-ext:*evaluator-mode* :interpret)) + (eval `(let () + (defmacro empty-let-is-not-toplevel-x () :macro) + (defun empty-let-is-not-toplevel-fun () + (empty-let-is-not-toplevel-x)))) + (assert (eq :macro (empty-let-is-not-toplevel-fun))) + (eval `(defun empty-let-is-not-toplevel-x () :fun)) + (assert (eq :fun (empty-let-is-not-toplevel-fun))))) + ;;; success -- 1.7.10.4