comparison src/evalvars.c @ 27517:f00a7a2bee21 v8.2.4286

patch 8.2.4286: Vim9: strict type checking after copy() and deepcopy() Commit: https://github.com/vim/vim/commit/381692b6f1c2ec9b73a139500286ddc9347a1c01 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 2 20:01:27 2022 +0000 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 https://github.com/vim/vim/issues/9644)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Feb 2022 21:15:03 +0100
parents a14c4d3e3260
children d4921b91542c
comparison
equal deleted inserted replaced
27516:fdcbdd530e4c 27517:f00a7a2bee21
3693 init_tv(tv); 3693 init_tv(tv);
3694 } 3694 }
3695 free_tv_arg = FALSE; 3695 free_tv_arg = FALSE;
3696 3696
3697 if (vim9script && type != NULL) 3697 if (vim9script && type != NULL)
3698 { 3698 set_tv_type(dest_tv, type);
3699 if (type->tt_type == VAR_DICT && dest_tv->vval.v_dict != NULL)
3700 {
3701 if (dest_tv->vval.v_dict->dv_type != type)
3702 {
3703 free_type(dest_tv->vval.v_dict->dv_type);
3704 dest_tv->vval.v_dict->dv_type = alloc_type(type);
3705 }
3706 }
3707 else if (type->tt_type == VAR_LIST && dest_tv->vval.v_list != NULL)
3708 {
3709 if (dest_tv->vval.v_list->lv_type != type)
3710 {
3711 free_type(dest_tv->vval.v_list->lv_type);
3712 dest_tv->vval.v_list->lv_type = alloc_type(type);
3713 }
3714 }
3715 }
3716 3699
3717 // ":const var = value" locks the value 3700 // ":const var = value" locks the value
3718 // ":final var = value" locks "var" 3701 // ":final var = value" locks "var"
3719 if (flags & ASSIGN_CONST) 3702 if (flags & ASSIGN_CONST)
3720 // Like :lockvar! name: lock the value and what it contains, but only 3703 // Like :lockvar! name: lock the value and what it contains, but only