]> granicus.if.org Git - vim/commitdiff
patch 8.2.1572: Vim9: expand() does not take "true" as argument v8.2.1572
authorBram Moolenaar <Bram@vim.org>
Wed, 2 Sep 2020 19:37:56 +0000 (21:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 2 Sep 2020 19:37:56 +0000 (21:37 +0200)
Problem:    Vim9: expand() does not take "true" as argument.
Solution:   Use tv_get_bool_chk().  (closes #6819)

src/evalfunc.c
src/testdir/test_vim9_func.vim
src/version.c

index 771e393db671b8ae6b27a46bd694493e6b75f49f..69f781632991529731f9b87cd4de50bec75a23d4 100644 (file)
@@ -2434,7 +2434,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
     rettv->v_type = VAR_STRING;
     if (argvars[1].v_type != VAR_UNKNOWN
            && argvars[2].v_type != VAR_UNKNOWN
-           && tv_get_number_chk(&argvars[2], &error)
+           && tv_get_bool_chk(&argvars[2], &error)
            && !error)
        rettv_list_set(rettv, NULL);
 
@@ -2458,7 +2458,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
        // When the optional second argument is non-zero, don't remove matches
        // for 'wildignore' and don't put matches for 'suffixes' at the end.
        if (argvars[1].v_type != VAR_UNKNOWN
-                                   && tv_get_number_chk(&argvars[1], &error))
+                                   && tv_get_bool_chk(&argvars[1], &error))
            options |= WILD_KEEP_ALL;
        if (!error)
        {
index 8f4928ac0e3c742005bfde882ecf499aa14cda0a..cf48ba8660e0695cac25a7991cb84c3be0e3d629 100644 (file)
@@ -1497,6 +1497,12 @@ def Test_count()
   assert_equal(0, count('ABC ABC ABC', 'b', false))
 enddef
 
+def Test_expand()
+  split SomeFile
+  assert_equal(['SomeFile'], expand('%', true, true))
+  close
+enddef
+
 def Test_recursive_call()
   assert_equal(6765, Fibonacci(20))
 enddef
index 9399221cd5627f1733d810c8e9358e9981ef299c..c674148ee1646b22a9b7a35736fb52eab60b288f 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1572,
 /**/
     1571,
 /**/