From 8fa4431617a64ef0b5fe70aa2d1c725a8e6ce4cf Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 19 Nov 2002 00:42:29 +0000 Subject: [PATCH] 0.7.9.55: Fix some more LOOP compliance issues ... signal a package error if the package doesn't exist ... the loop block should surround variable initialization forms --- src/code/loop.lisp | 6 +++--- src/code/package.lisp | 10 +++++++++- tests/loop.pure.lisp | 9 +++++++++ version.lisp-expr | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/code/loop.lisp b/src/code/loop.lisp index d6e83a9..59504a9 100644 --- a/src/code/loop.lisp +++ b/src/code/loop.lisp @@ -800,9 +800,6 @@ code to be loaded. ,(nreverse *loop-after-body*) ,(nreconc *loop-epilogue* (nreverse *loop-after-epilogue*))))) - (do () (nil) - (setq answer `(block ,(pop *loop-names*) ,answer)) - (unless *loop-names* (return nil))) (dolist (entry *loop-bind-stack*) (let ((vars (first entry)) (dcls (second entry)) @@ -818,6 +815,9 @@ code to be loaded. ,vars ,@(loop-build-destructuring-bindings crocks forms))))))) + (do () (nil) + (setq answer `(block ,(pop *loop-names*) ,answer)) + (unless *loop-names* (return nil))) answer))) (defun loop-iteration-driver () diff --git a/src/code/package.lisp b/src/code/package.lisp index e376b9d..9d47baf 100644 --- a/src/code/package.lisp +++ b/src/code/package.lisp @@ -231,7 +231,13 @@ (,packages `,(mapcar (lambda (package) (if (packagep package) package - (find-package package))) + ;; Maybe FIND-PACKAGE-OR-DIE? + (or (find-package package) + (error 'simple-package-error + ;; could be a character + :name (string package) + :format-control "~@<~S does not name a package ~:>" + :format-arguments (list package))))) (if (consp ,these-packages) ,these-packages (list ,these-packages)))) @@ -244,6 +250,7 @@ `(setf ,package-use-list (package-%use-list (car ,packages))) `(declare (ignore ,package-use-list))) (macrolet ((,init-macro (next-kind) + (declare (optimize (inhibit-warnings 3))) (let ((symbols (gensym))) `(progn (setf ,',kind ,next-kind) @@ -295,6 +302,7 @@ (flet ((,real-symbol-p (number) (> number 1))) (macrolet ((,mname () + (declare (optimize (inhibit-warnings 3))) `(block ,',BLOCK (loop (case ,',kind diff --git a/tests/loop.pure.lisp b/tests/loop.pure.lisp index bed64e1..73c45e3 100644 --- a/tests/loop.pure.lisp +++ b/tests/loop.pure.lisp @@ -83,3 +83,12 @@ (let ((*package* (find-package :cl))) (assert (= (loop for x being each external-symbol count t) 978))) + +(assert (eq (loop for a = (return t) return nil) t)) + +(multiple-value-bind (result error) + (ignore-errors + (loop for nil being the external-symbols of :nonexistent-package + count t)) + (assert (null result)) + (assert (typep error 'package-error))) diff --git a/version.lisp-expr b/version.lisp-expr index cbc55fc..9be2bff 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.9.54" +"0.7.9.55" -- 1.7.10.4