diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 17:43:38 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 18:06:00 +0800 |
commit | 38c113ae842aa8c42ad66bba15f16cf401637ab8 (patch) | |
tree | 39b6b557e14b67adda4a621d54c7af6a6f709c9e | |
parent | e25193143bca3a48920322634120a442854bb891 (diff) | |
download | rneovim-38c113ae842aa8c42ad66bba15f16cf401637ab8.tar.gz rneovim-38c113ae842aa8c42ad66bba15f16cf401637ab8.tar.bz2 rneovim-38c113ae842aa8c42ad66bba15f16cf401637ab8.zip |
vim-patch:8.2.1600: Vim9: cannot use "true" with deepcopy()
Problem: Vim9: cannot use "true" with deepcopy().
Solution: Use tv_get_bool_chk(). (closes vim/vim#6867)
https://github.com/vim/vim/commit/44b4a246b62e0622550b963bcf3034dce3bcfc0c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/eval/funcs.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_listdict.vim | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 1661a7079e..553a377d21 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -1360,7 +1360,7 @@ static void f_deepcopy(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) int noref = 0; 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) { semsg(_(e_using_number_as_bool_nr), noref); diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim index 7cb48876e8..ecf95ba8c0 100644 --- a/src/nvim/testdir/test_listdict.vim +++ b/src/nvim/testdir/test_listdict.vim @@ -336,12 +336,12 @@ func Test_dict_deepcopy() let l = [4, d, 6] let d[3] = l let dc = deepcopy(d) - call assert_fails('call deepcopy(d, 1)', 'E698') + call assert_fails('call deepcopy(d, 1)', 'E698:') let l2 = [0, l, l, 3] 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 |