patch 9.1.1017: Vim9: Patch 9.1.1013 causes a few problems
Problem: Vim9: Patch 9.1.1013 causes a few problems
Solution: Translate the function name only when it is a string
(Yegappan Lakshmanan)
fixes: #16453
closes: #16450
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6314252..71e3448 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3769,14 +3769,17 @@
if (func == NULL || *func == NUL)
return; // type error, empty name or null function
- char_u *p = func;
- tofree = trans_function_name(&p, NULL, FALSE, TFN_INT|TFN_QUIET);
- if (tofree == NULL)
+ if (argvars[0].v_type == VAR_STRING)
{
- emsg_funcname(e_unknown_function_str, func);
- return;
+ char_u *p = func;
+ tofree = trans_function_name(&p, NULL, FALSE, TFN_INT|TFN_QUIET);
+ if (tofree == NULL)
+ {
+ emsg_funcname(e_unknown_function_str, func);
+ return;
+ }
+ func = tofree;
}
- func = tofree;
if (argvars[2].v_type != VAR_UNKNOWN)
{
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 8b0af91..9fc954c 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2990,6 +2990,8 @@
func Test_call()
call assert_equal(3, call('len', [123]))
call assert_equal(3, 'len'->call([123]))
+ call assert_equal(4, call({ x -> len(x) }, ['xxxx']))
+ call assert_equal(2, call(function('len'), ['xx']))
call assert_fails("call call('len', 123)", 'E1211:')
call assert_equal(0, call('', []))
call assert_equal(0, call('len', test_null_list()))
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 38832e9..4e31f34 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
Binary files differ
diff --git a/src/version.c b/src/version.c
index 13ffc5d..39c0aa6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1017,
+/**/
1016,
/**/
1015,