0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

patch 8.2.1600: Vim9: cannot use "true" with deepcopy()

Problem:    Vim9: cannot use "true" with deepcopy().
Solution:   Use tv_get_bool_chk(). (closes #6867)
This commit is contained in:
Bram Moolenaar 2020-09-05 17:18:28 +02:00
parent 59941cbd80
commit 44b4a246b6
4 changed files with 6 additions and 2 deletions

View File

@ -1975,7 +1975,7 @@ f_deepcopy(typval_T *argvars, typval_T *rettv)
int copyID; int copyID;
if (argvars[1].v_type != VAR_UNKNOWN) if (argvars[1].v_type != VAR_UNKNOWN)
noref = (int)tv_get_number_chk(&argvars[1], NULL); noref = (int)tv_get_bool_chk(&argvars[1], NULL);
if (noref < 0 || noref > 1) if (noref < 0 || noref > 1)
emsg(_(e_invarg)); emsg(_(e_invarg));
else else

View File

@ -348,7 +348,7 @@ func Test_dict_deepcopy()
let l[1] = l2 let l[1] = l2
let l3 = deepcopy(l2) let l3 = deepcopy(l2)
call assert_true(l3[1] is l3[2]) call assert_true(l3[1] is l3[2])
call assert_fails("call deepcopy([1, 2], 2)", 'E474:') call assert_fails("call deepcopy([1, 2], 2)", 'E1023:')
endfunc endfunc
" Locked variables " Locked variables

View File

@ -1272,6 +1272,8 @@ def Test_copy_return_type()
res += n res += n
endfor endfor
assert_equal(6, res) assert_equal(6, res)
dl = deepcopy([1, 2, 3], true)
enddef enddef
def Test_extend_return_type() def Test_extend_return_type()

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1600,
/**/ /**/
1599, 1599,
/**/ /**/