0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.3117: Vim9: type not properly checked in for loop

Problem:    Vim9: type not properly checked in for loop.
Solution:   Have items() return a list of lists.  Add runtime type checks.
            (closes #8515)
This commit is contained in:
Bram Moolenaar
2021-07-07 21:21:30 +02:00
parent 90df4b9d42
commit efc5db5215
5 changed files with 23 additions and 3 deletions

View File

@@ -7932,8 +7932,11 @@ compile_for(char_u *arg_start, cctx_T *cctx)
if (lhs_type == &t_any)
lhs_type = item_type;
else if (item_type != &t_unknown
&& !(var_list && item_type == &t_any)
&& check_type(lhs_type, item_type, TRUE, where) == FAIL)
&& ((var_list && item_type == &t_any)
? need_type(item_type, lhs_type,
-1, 0, cctx, FALSE, FALSE)
: check_type(lhs_type, item_type, TRUE, where))
== FAIL)
goto failed;
var_lvar = reserve_local(cctx, arg, varlen, TRUE, lhs_type);
if (var_lvar == NULL)