Commit bed17857 authored by pfdietz's avatar pfdietz

Add free declaration scope tests for iteration forms

parent 4a093636
......@@ -121,5 +121,45 @@
(push #'(lambda () i) x))))
(5 5 5 5 5))
;;; Scope of free declarations
(deftest do.16
(block done
(let ((x :bad))
(declare (special x))
(let ((x :good))
(do ((i (return-from done x) 0))
(t nil)
(declare (special x))))))
:good)
(deftest do.17
(block done
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do ((i 0 (return-from done x)))
(nil nil)
(declare (special x))))))
:good)
(deftest do.18
(block done
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do ((i 0 0))
((return-from done x) nil)
(declare (special x))))))
:good)
(deftest do.19
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do () (t x)
(declare (special x)))))
:good)
(def-macro-test do.error.1
(do ((i 0 (1+ i))) ((= i 5) 'a)))
......@@ -112,6 +112,25 @@
(when (eq e 'c) (return x))))
(c b a))
;;; Scope of free declarations
(deftest dolist.16
(block done
(let ((x :bad))
(declare (special x))
(let ((x :good))
(dolist (e (return-from done x))
(declare (special x))))))
:good)
(deftest dolist.17
(let ((x :good))
(declare (special x))
(let ((x :bad))
(dolist (e nil x)
(declare (special x)))))
:good)
(def-macro-test dolist.error.1
(dolist (x nil)))
......@@ -121,5 +121,45 @@
(push #'(lambda () i) x))))
(5 5 5 5 5))
;;; Scope of free declarations
(deftest do*.16
(block done
(let ((x :bad))
(declare (special x))
(let ((x :good))
(do* ((i (return-from done x) 0))
(t nil)
(declare (special x))))))
:good)
(deftest do*.17
(block done
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do* ((i 0 (return-from done x)))
(nil nil)
(declare (special x))))))
:good)
(deftest do*.18
(block done
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do* ((i 0 0))
((return-from done x) nil)
(declare (special x))))))
:good)
(deftest do*.19
(let ((x :good))
(declare (special x))
(let ((x :bad))
(do* () (t x)
(declare (special x)))))
:good)
(def-macro-test do*.error.1
(do* ((i 0 (1+ i))) ((= i 5) 'a)))
......@@ -147,5 +147,24 @@
(incf x)))
0 0)
;;; Scope of free declarations
(deftest dotimes.22
(block done
(let ((x :bad))
(declare (special x))
(let ((x :good))
(dotimes (i (return-from done x))
(declare (special x))))))
:good)
(deftest dotimes.23
(let ((x :good))
(declare (special x))
(let ((x :bad))
(dotimes (i 10 x)
(declare (special x)))))
:good)
(def-macro-test dotimes.error.1
(dotimes (i 10)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment