]> granicus.if.org Git - vim/commitdiff
patch 8.2.1600: Vim9: cannot use "true" with deepcopy() v8.2.1600
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 15:18:28 +0000 (17:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 15:18:28 +0000 (17:18 +0200)
Problem:    Vim9: cannot use "true" with deepcopy().
Solution:   Use tv_get_bool_chk(). (closes #6867)

src/evalfunc.c
src/testdir/test_listdict.vim
src/testdir/test_vim9_func.vim
src/version.c

index 110935df3dc455931f8145ca3b497216bf0c513d..1764f414ea7ef2e9aa471abbab8f5e09657e5c76 100644 (file)
@@ -1975,7 +1975,7 @@ f_deepcopy(typval_T *argvars, typval_T *rettv)
     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
index 8db7b3f168692c671974388b0ff15f7207a17ca5..694ba0a4103e655b05ca20fc29c91d2abb3fe935 100644 (file)
@@ -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
index 828dbba3d06be31e788072c3740e8f5c473b8b33..8651ef8ebdc4f1fa586ada97f432b7507486b1c4 100644 (file)
@@ -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()
index b7b5d272e8654b84ff23da1ecd093ffdd9342378..8ebf9a71671d6edaa12c8684321458e4ea677fb5 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1600,
 /**/
     1599,
 /**/