Mercurial > vim
changeset 22101:0ee66f232839 v8.2.1600
patch 8.2.1600: Vim9: cannot use "true" with deepcopy()
Commit: https://github.com/vim/vim/commit/44b4a246b62e0622550b963bcf3034dce3bcfc0c
Author: Bram Moolenaar <Bram@vim.org>
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Sep 2020 17:30:03 +0200 |
parents | bb0a4e51c4c5 |
children | 2a7b430646c4 |
files | src/evalfunc.c src/testdir/test_listdict.vim src/testdir/test_vim9_func.vim src/version.c |
diffstat | 4 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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