changeset 22045:47ff9e5be532 v8.2.1572

patch 8.2.1572: Vim9: expand() does not take "true" as argument Commit: https://github.com/vim/vim/commit/551d25e76545df785a9f62df52f34bc1dd368bfb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 2 21:37:56 2020 +0200 patch 8.2.1572: Vim9: expand() does not take "true" as argument Problem: Vim9: expand() does not take "true" as argument. Solution: Use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6819)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Sep 2020 21:45:04 +0200
parents b70b9b4bcf4e
children 2850dc9b0849
files src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2434,7 +2434,7 @@ f_expand(typval_T *argvars, typval_T *re
     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 *re
 	// 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)
 	{
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -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
--- 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 */
 /**/
+    1572,
+/**/
     1571,
 /**/
     1570,