Mercurial > vim
changeset 22053:0794909e2988 v8.2.1576
patch 8.2.1576: Vim9: index() does not take "true" as argument
Commit: https://github.com/vim/vim/commit/6c553f9c04a698ac2e19584f8ea8e2cb7cd98c80
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 2 22:10:34 2020 +0200
patch 8.2.1576: Vim9: index() does not take "true" as argument
Problem: Vim9: index() does not take "true" as argument.
Solution: Use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6823)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Sep 2020 22:15:03 +0200 |
parents | ca8884cbf94b |
children | a7d9a93a4d80 |
files | src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c |
diffstat | 3 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4944,7 +4944,7 @@ f_index(typval_T *argvars, typval_T *ret item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); idx = l->lv_u.mat.lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) - ic = (int)tv_get_number_chk(&argvars[3], &error); + ic = (int)tv_get_bool_chk(&argvars[3], &error); if (error) item = NULL; }
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1497,6 +1497,10 @@ def Test_count() assert_equal(0, count('ABC ABC ABC', 'b', false)) enddef +def Test_index() + assert_equal(3, index(['a', 'b', 'a', 'B'], 'b', 2, true)) +enddef + def Test_expand() split SomeFile assert_equal(['SomeFile'], expand('%', true, true))