patch 8.2.1378: cannot put space between function name and paren
Problem: Cannot put space between function name and paren.
Solution: Allow this for backwards compatibility.
diff --git a/src/eval.c b/src/eval.c
index a7f6086..877b3bc 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3198,9 +3198,12 @@
{
int flags = evalarg == NULL ? 0 : evalarg->eval_flags;
- if (**arg == '(')
+ if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
+ {
// "name(..." recursive!
+ *arg = skipwhite(*arg);
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
+ }
else if (flags & EVAL_CONSTANT)
ret = FAIL;
else if (evaluate)
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index b4eeea6..cfae760 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -599,6 +599,11 @@
call assert_fails("let v = -{}", 'E728:')
endfunc
+func Test_white_in_function_call()
+ let text = substitute ( 'some text' , 't' , 'T' , 'g' )
+ call assert_equal('some TexT', text)
+endfunc
+
" Test for float value comparison
func Test_float_compare()
CheckFeature float
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index aa705b2..746983d 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1686,6 +1686,10 @@
assert_equal([0, 1, 2], --3->range())
call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:')
+ call CheckScriptFailure([
+ "vim9script",
+ "let x = substitute ('x', 'x', 'x', 'x')"
+ ], 'E121:')
enddef
diff --git a/src/version.c b/src/version.c
index f5eb42b..ba24f69 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1378,
+/**/
1377,
/**/
1376,