Skip to content

Commit 551d25e

Browse files
committed
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 #6819)
1 parent 119f557 commit 551d25e

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/evalfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
24342434
rettv->v_type = VAR_STRING;
24352435
if (argvars[1].v_type != VAR_UNKNOWN
24362436
&& argvars[2].v_type != VAR_UNKNOWN
2437-
&& tv_get_number_chk(&argvars[2], &error)
2437+
&& tv_get_bool_chk(&argvars[2], &error)
24382438
&& !error)
24392439
rettv_list_set(rettv, NULL);
24402440

@@ -2458,7 +2458,7 @@ f_expand(typval_T *argvars, typval_T *rettv)
24582458
// When the optional second argument is non-zero, don't remove matches
24592459
// for 'wildignore' and don't put matches for 'suffixes' at the end.
24602460
if (argvars[1].v_type != VAR_UNKNOWN
2461-
&& tv_get_number_chk(&argvars[1], &error))
2461+
&& tv_get_bool_chk(&argvars[1], &error))
24622462
options |= WILD_KEEP_ALL;
24632463
if (!error)
24642464
{

src/testdir/test_vim9_func.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,12 @@ def Test_count()
14971497
assert_equal(0, count('ABC ABC ABC', 'b', false))
14981498
enddef
14991499

1500+
def Test_expand()
1501+
split SomeFile
1502+
assert_equal(['SomeFile'], expand('%', true, true))
1503+
close
1504+
enddef
1505+
15001506
def Test_recursive_call()
15011507
assert_equal(6765, Fibonacci(20))
15021508
enddef

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1572,
757759
/**/
758760
1571,
759761
/**/

0 commit comments

Comments
 (0)