summaryrefslogtreecommitdiffstats
path: root/src/evalvars.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-02 20:01:27 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-02 20:01:27 +0000
commit381692b6f1c2ec9b73a139500286ddc9347a1c01 (patch)
tree96145ec58ad29dd86bbc80e557377333c07d059b /src/evalvars.c
parenta1c519518050383e7d319514a3ff6c42a9154c48 (diff)
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()v8.2.4286
Problem: Vim9: strict type checking after copy() and deepcopy(). Solution: Allow type to change after making a copy. (closes #9644)
Diffstat (limited to 'src/evalvars.c')
-rw-r--r--src/evalvars.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index f88be3e8b9..b3436067f1 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -3695,24 +3695,7 @@ set_var_const(
free_tv_arg = FALSE;
if (vim9script && type != NULL)
- {
- if (type->tt_type == VAR_DICT && dest_tv->vval.v_dict != NULL)
- {
- if (dest_tv->vval.v_dict->dv_type != type)
- {
- free_type(dest_tv->vval.v_dict->dv_type);
- dest_tv->vval.v_dict->dv_type = alloc_type(type);
- }
- }
- else if (type->tt_type == VAR_LIST && dest_tv->vval.v_list != NULL)
- {
- if (dest_tv->vval.v_list->lv_type != type)
- {
- free_type(dest_tv->vval.v_list->lv_type);
- dest_tv->vval.v_list->lv_type = alloc_type(type);
- }
- }
- }
+ set_tv_type(dest_tv, type);
// ":const var = value" locks the value
// ":final var = value" locks "var"