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.
diff --git a/src/evalvars.c b/src/evalvars.c
index 8a7162c..31cd01d 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2883,12 +2883,17 @@
|| 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