# HG changeset patch # User Bram Moolenaar # Date 1599319803 -7200 # Node ID 0ee66f232839cb935b0416ce72b8152e76f7399a # Parent bb0a4e51c4c58ea87965ed08db2baa623edcf33a patch 8.2.1600: Vim9: cannot use "true" with deepcopy() Commit: https://github.com/vim/vim/commit/44b4a246b62e0622550b963bcf3034dce3bcfc0c Author: Bram Moolenaar Date: Sat Sep 5 17:18:28 2020 +0200 patch 8.2.1600: Vim9: cannot use "true" with deepcopy() Problem: Vim9: cannot use "true" with deepcopy(). Solution: Use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6867) diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1975,7 +1975,7 @@ f_deepcopy(typval_T *argvars, typval_T * int copyID; 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) emsg(_(e_invarg)); else diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -348,7 +348,7 @@ func Test_dict_deepcopy() let l[1] = l2 let l3 = deepcopy(l2) 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 " Locked variables diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1272,6 +1272,8 @@ def Test_copy_return_type() res += n endfor assert_equal(6, res) + + dl = deepcopy([1, 2, 3], true) enddef def Test_extend_return_type() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1600, +/**/ 1599, /**/ 1598,