# HG changeset patch # User Bram Moolenaar # Date 1599077703 -7200 # Node ID 0794909e2988cb71cbc2595cf2a21583bd9bbf62 # Parent ca8884cbf94bf6ea20fbfe0fea6c09fc8b1ac58e patch 8.2.1576: Vim9: index() does not take "true" as argument Commit: https://github.com/vim/vim/commit/6c553f9c04a698ac2e19584f8ea8e2cb7cd98c80 Author: Bram Moolenaar 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) diff --git a/src/evalfunc.c b/src/evalfunc.c --- 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; } 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 @@ -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)) 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 */ /**/ + 1576, +/**/ 1575, /**/ 1574,