mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy()
Problem: Vim9: strict type checking after copy() and deepcopy(). Solution: Allow type to change after making a copy. (closes #9644)
This commit is contained in:
@@ -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"
|
||||
|
Reference in New Issue
Block a user