1
0
forked from aniani/vim

patch 8.2.0973: Vim9: type is not checked when assigning to a script variable

Problem:    Vim9: type is not checked when assigning to a script variable.
Solution:   Check the type.
This commit is contained in:
Bram Moolenaar
2020-06-13 19:00:10 +02:00
parent c82a5b5da5
commit 34db91f7a4
7 changed files with 51 additions and 8 deletions

View File

@@ -2883,12 +2883,17 @@ set_var_const(
|| var_check_lock(di->di_tv.v_lock, name, FALSE))
return;
if ((flags & LET_NO_COMMAND) == 0
&& is_script_local
&& current_sctx.sc_version == SCRIPT_VERSION_VIM9)
if (is_script_local
&& current_sctx.sc_version == SCRIPT_VERSION_VIM9)
{
semsg(_("E1041: Redefining script item %s"), name);
return;
if ((flags & LET_NO_COMMAND) == 0)
{
semsg(_("E1041: Redefining script item %s"), name);
return;
}
// check the type
check_script_var_type(&di->di_tv, tv, name);
}
}
else