Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
569067e1
by Raymond Toy at 2024-02-14T15:59:07+00:00
-
f570ce79
by Raymond Toy at 2024-02-14T15:59:10+00:00
2 changed files:
Changes:
... | ... | @@ -1169,7 +1169,10 @@ collected result will be returned as the value of the LOOP." |
1169 | 1169 | ;; these type symbols.
|
1170 | 1170 | (let ((type-spec (or (gethash z (loop-universe-type-symbols *loop-universe*))
|
1171 | 1171 | (gethash (symbol-name z) (loop-universe-type-keywords *loop-universe*)))))
|
1172 | - (when type-spec
|
|
1172 | + ;; If Z is NIL, we have something like (loop for var nil ...).
|
|
1173 | + ;; In that case, we need to pop the source to skip over the
|
|
1174 | + ;; type, just as if we had (loop for var fixnum ...)
|
|
1175 | + (when (or type-spec (null z))
|
|
1173 | 1176 | (loop-pop-source)
|
1174 | 1177 | type-spec)))
|
1175 | 1178 | (t
|
1 | +;;; Tests from gitlab issues
|
|
2 | + |
|
3 | +(defpackage :loop-tests
|
|
4 | + (:use :cl :lisp-unit))
|
|
5 | + |
|
6 | +(in-package "LOOP-TESTS")
|
|
7 | + |
|
8 | +(define-test loop-var-nil
|
|
9 | + (:tag :issues)
|
|
10 | + ;; Just verify that (loop for var nil ...) works. Previously it
|
|
11 | + ;; signaled an error. See Gitlab issue #256.
|
|
12 | + (assert-equal '(1 2)
|
|
13 | + (loop for var nil from 1 to 2 collect var)))
|
|
14 | + |