summaryrefslogtreecommitdiff
path: root/src/vim9cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-02 16:20:26 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-02 16:20:26 +0000
commita1c519518050383e7d319514a3ff6c42a9154c48 (patch)
treeb2263814d4ed499842a1a1f381a7d1930720e26b /src/vim9cmds.c
parentab8f7c50cf7d5c0c72dfa5067e5b1f57585db4d8 (diff)
downloadvim-git-a1c519518050383e7d319514a3ff6c42a9154c48.tar.gz
patch 8.2.4285: Vim9: type of item in for loop not checked properlyv8.2.4285
Problem: Vim9: type of item in for loop not checked properly. Solution: Adjust the type checking. (closes #9683)
Diffstat (limited to 'src/vim9cmds.c')
-rw-r--r--src/vim9cmds.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/vim9cmds.c b/src/vim9cmds.c
index 716a40411..90b61dbb3 100644
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -990,11 +990,8 @@ compile_for(char_u *arg_start, cctx_T *cctx)
if (lhs_type == &t_any)
lhs_type = item_type;
else if (item_type != &t_unknown
- && (item_type == &t_any
- ? need_type(item_type, lhs_type,
- -1, 0, cctx, FALSE, FALSE)
- : check_type(lhs_type, item_type, TRUE, where))
- == FAIL)
+ && need_type_where(item_type, lhs_type, -1,
+ where, cctx, FALSE, FALSE) == FAIL)
goto failed;
var_lvar = reserve_local(cctx, arg, varlen, TRUE, lhs_type);
if (var_lvar == NULL)
@@ -1003,8 +1000,6 @@ compile_for(char_u *arg_start, cctx_T *cctx)
if (semicolon && idx == var_count - 1)
var_lvar->lv_type = vartype;
- else
- var_lvar->lv_type = item_type;
generate_STORE(cctx, ISN_STORE, var_lvar->lv_idx, NULL);
}