summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-14 22:16:13 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-14 22:16:13 +0200
commit5582ef14384525e8cec86016876d97a6b32dd548 (patch)
treedf821155d69edf17b04df6a131d25f7fd1f1a03e
parent789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35 (diff)
patch 8.0.0004v8.0.0004
Problem: A string argument for function() that is not a function name results in an error message with NULL. (Christian Brabandt) Solution: Use the argument for the error message.
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/testdir/test_expr.vim3
-rw-r--r--src/version.c2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7dd5c2a4d2..3207441c2d 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3612,7 +3612,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|| (is_funcref && trans_name == NULL))
- EMSG2(_(e_invarg2), s);
+ EMSG2(_(e_invarg2), use_string ? get_tv_string(&argvars[0]) : s);
/* Don't check an autoload name for existence here. */
else if (trans_name != NULL && (is_funcref
? find_func(trans_name) == NULL
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index 108ee508ea..dff8e36f4e 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -439,6 +439,9 @@ func Test_function_with_funcref()
let s:fref = function(s:f)
call assert_equal(v:t_string, s:fref('x'))
call assert_fails("call function('s:f')", 'E700:')
+
+ call assert_fails("call function('foo()')", 'E475:')
+ call assert_fails("call function('foo()')", 'foo()')
endfunc
func Test_funcref()
diff --git a/src/version.c b/src/version.c
index dcf02c288c..5634114385 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4,
+/**/
3,
/**/
2,