From: Bram Moolenaar Date: Wed, 2 Sep 2020 20:10:34 +0000 (+0200) Subject: patch 8.2.1576: Vim9: index() does not take "true" as argument X-Git-Tag: v8.2.1576 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c553f9c04a698ac2e19584f8ea8e2cb7cd98c80;p=vim 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 #6823) --- diff --git a/src/evalfunc.c b/src/evalfunc.c index 340ecf095..4f0bb5cea 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4944,7 +4944,7 @@ f_index(typval_T *argvars, typval_T *rettv) 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 index 11a6ddd01..04f8d7aa7 100644 --- 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 index 2bf491460..388be57e3 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1576, /**/ 1575, /**/