patch 8.2.2760: Vim9: no error for changing a for loop variable
Problem: Vim9: no error for changing a for loop variable.
Solution: Make the loop variable read-only. (issue #8102)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index bcba1e3..4a55f19 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -7590,7 +7590,7 @@
// Reserve a variable to store "var".
// TODO: check for type
- var_lvar = reserve_local(cctx, arg, varlen, FALSE, &t_any);
+ var_lvar = reserve_local(cctx, arg, varlen, TRUE, &t_any);
if (var_lvar == NULL)
// out of memory or used as an argument
goto failed;