From d44beaa294d42f20e84b02aa44a8c20ef7769298 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Thu, 6 Nov 2014 21:04:53 -0800
Subject: [PATCH] Generate a loop error if the variable is not a symbol for the
 string codepoint and glyph iterators.

---
 src/code/loop.lisp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/code/loop.lisp b/src/code/loop.lisp
index 29b9c23f0..8e50390b7 100644
--- a/src/code/loop.lisp
+++ b/src/code/loop.lisp
@@ -2168,6 +2168,8 @@ collected result will be returned as the value of the LOOP."
   (cond ((or (cdr prep-phrases) (not (member (caar prep-phrases) '(:in :of))))
 	 (loop-error _N"Too many prepositions!"))
 	((null prep-phrases) (loop-error _N"Missing OF or IN in ~S iteration path.")))
+  (unless (symbolp variable)
+    (loop-error _N"Destructuring is not valid for string codepoint iteration."))
   (let ((string-var (loop-gentemp 'loop-codepoint-string-))
 	(next-fn (loop-gentemp 'loop-codepoint-next-))
 	(post-steps nil))
@@ -2201,6 +2203,8 @@ collected result will be returned as the value of the LOOP."
   (cond ((or (cdr prep-phrases) (not (member (caar prep-phrases) '(:in :of))))
 	 (loop-error _N"Too many prepositions!"))
 	((null prep-phrases) (loop-error _N"Missing OF or IN in ~S iteration path.")))
+  (unless (symbolp variable)
+    (loop-error _N"Destructuring is not valid for string glyph iteration."))
   (let ((string-var (loop-gentemp 'loop-glyph-string-))
 	(next-fn (loop-gentemp 'loop-glyph-next-))
 	(post-steps nil))
-- 
GitLab