Problem: v:maxcol can be changed in a :for loop.
Solution: Check for read-only loop variable. (closes #12470)
}
if ((flags & ASSIGN_FOR_LOOP) == 0
- && var_check_permission(di, name) == FAIL)
+ ? var_check_permission(di, name) == FAIL
+ : var_check_ro(di->di_flags, name, FALSE))
goto failed;
}
else
call assert_fails("for x in 99", 'E1098:')
call assert_fails("for x in function('winnr')", 'E1098:')
call assert_fails("for x in {'a': 9}", 'E1098:')
+ call assert_fails("for v:maxcol in range(1)", 'E46:')
if 0
/1/5/2/s/\n
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1611,
/**/
1610,
/**/