Commit 11063122 authored by pfdietz's avatar pfdietz

More declaration scope tests

parent 2d599fde
...@@ -478,3 +478,29 @@ ...@@ -478,3 +478,29 @@
y)) y))
(%f)))) (%f))))
:good) :good)
(deftest flet.64
(let ((x :bad))
(declare (special x))
(let ((x :good))
(flet () (declare (special x)))
x))
:good)
(deftest flet.65
(let ((x :bad))
(declare (special x))
(let ((x :good))
(flet ((%f () (declare (special x)))))
x))
:good)
(deftest flet.66
(let ((x :bad))
(declare (special x))
(let ((x :good))
(flet ((%f () (declare (special x))))
x)))
:good)
\ No newline at end of file
...@@ -320,4 +320,26 @@ ...@@ -320,4 +320,26 @@
(%f)))) (%f))))
:good) :good)
(deftest labels.43
(let ((x :bad))
(declare (special x))
(let ((x :good))
(labels () (declare (special x)))
x))
:good)
(deftest labels.44
(let ((x :bad))
(declare (special x))
(let ((x :good))
(labels ((%f () (declare (special x)))))
x))
:good)
(deftest labels.45
(let ((x :bad))
(declare (special x))
(let ((x :good))
(labels ((%f () (declare (special x))))
x)))
:good)
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
;;; Tests of large number of LET variables ;;; Tests of large number of LET variables
(deftest let.14 (deftest let.14
(let* ((n 1000) (let* ((n 100)
(vars (mapcar #'gensym (make-list n :initial-element "G"))) (vars (mapcar #'gensym (make-list n :initial-element "G")))
(expr `(let ,(let ((i 0)) (expr `(let ,(let ((i 0))
(mapcar #'(lambda (v) (list v (incf i))) vars)) (mapcar #'(lambda (v) (list v (incf i))) vars))
...@@ -130,6 +130,27 @@ ...@@ -130,6 +130,27 @@
y))) y)))
:good) :good)
(deftest let.17a
(funcall
(compile
nil
'(lambda ()
(let ((x :bad))
(declare (special x))
(let ((x :good)) ;; lexical binding
(let ((y x))
(declare (special x)) ;; free declaration
y))))))
:good)
(deftest let.18
(let ((foo 'special))
(declare (special foo))
(let ((foo 'lexical))
(locally (declare (special foo)))
foo))
lexical)
;;; Tests for LET* ;;; Tests for LET*
(deftest let*.1 (deftest let*.1
...@@ -208,7 +229,7 @@ ...@@ -208,7 +229,7 @@
;;; Tests of large number of LET* variables ;;; Tests of large number of LET* variables
(deftest let*.14 (deftest let*.14
(let* ((n 1000) (let* ((n 100)
(vars (mapcar #'gensym (make-list n :initial-element "G"))) (vars (mapcar #'gensym (make-list n :initial-element "G")))
(expr `(let* ,(let ((i 0)) (expr `(let* ,(let ((i 0))
(mapcar #'(lambda (v) (list v (incf i))) vars)) (mapcar #'(lambda (v) (list v (incf i))) vars))
...@@ -249,3 +270,37 @@ ...@@ -249,3 +270,37 @@
y))) y)))
:good) :good)
(deftest let*.17a
(funcall
(compile
nil
'(lambda ()
(let ((x :bad))
(declare (special x))
(let ((x :good)) ;; lexical binding
(let* ((y x))
(declare (special x)) ;; free declaration
y))))))
:good)
(deftest let*.18
(let ((x :bad1)
(z :bad2))
(declare (special x z))
(let ((x :good)
(z :good)) ;; lexical bindings
(let* ((y x)
(w z))
(declare (special x)) ;; free declaration
(values y w))))
:good
:good)
(deftest let*.19
(let ((foo 'special))
(declare (special foo))
(let* ((foo 'lexical))
(locally (declare (special foo)))
foo))
lexical)
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