comparison src/vim9execute.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 69a48bcd1d80
children 0b12dd90a5d6
comparison
equal deleted inserted replaced
27516:fdcbdd530e4c 27517:f00a7a2bee21
4410 4410
4411 if ((di = dict_find(dict, iptr->isn_arg.string, -1)) 4411 if ((di = dict_find(dict, iptr->isn_arg.string, -1))
4412 == NULL) 4412 == NULL)
4413 { 4413 {
4414 SOURCING_LNUM = iptr->isn_lnum; 4414 SOURCING_LNUM = iptr->isn_lnum;
4415 semsg(_(e_key_not_present_in_dictionary), iptr->isn_arg.string); 4415 semsg(_(e_key_not_present_in_dictionary),
4416 iptr->isn_arg.string);
4416 goto on_error; 4417 goto on_error;
4417 } 4418 }
4418 // Put the dict used on the dict stack, it might be used by 4419 // Put the dict used on the dict stack, it might be used by
4419 // a dict function later. 4420 // a dict function later.
4420 if (dict_stack_save(tv) == FAIL) 4421 if (dict_stack_save(tv) == FAIL)
4529 } 4530 }
4530 } 4531 }
4531 break; 4532 break;
4532 4533
4533 case ISN_SETTYPE: 4534 case ISN_SETTYPE:
4534 { 4535 set_tv_type(STACK_TV_BOT(-1), iptr->isn_arg.type.ct_type);
4535 checktype_T *ct = &iptr->isn_arg.type;
4536
4537 tv = STACK_TV_BOT(-1);
4538 if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
4539 {
4540 free_type(tv->vval.v_dict->dv_type);
4541 tv->vval.v_dict->dv_type = alloc_type(ct->ct_type);
4542 }
4543 else if (tv->v_type == VAR_LIST && tv->vval.v_list != NULL)
4544 {
4545 free_type(tv->vval.v_list->lv_type);
4546 tv->vval.v_list->lv_type = alloc_type(ct->ct_type);
4547 }
4548 }
4549 break; 4536 break;
4550 4537
4551 case ISN_2BOOL: 4538 case ISN_2BOOL:
4552 case ISN_COND2BOOL: 4539 case ISN_COND2BOOL:
4553 { 4540 {