summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-25 19:43:44 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-25 19:43:44 +0000
commitae1068afde6dfc6fd3e3f54512dbd089e1559053 (patch)
treec684e064f5c464b4e275190bedff17cfea8d9d1a /src/evalfunc.c
parent223d0a6bc8dc68039ceb6660de9576fafe178d73 (diff)
patch 8.2.3895: Vim9: confusing error when using function() with a numberv8.2.3895
Problem: Vim9: confusing error when using function() with a number. Solution: Check for a function or string argument.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index e4fa35b4ef..9e0fd805d8 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3998,7 +3998,8 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
int is_global = FALSE;
if (in_vim9script()
- && (check_for_opt_list_arg(argvars, 1) == FAIL
+ && (check_for_string_or_func_arg(argvars, 0) == FAIL
+ || check_for_opt_list_arg(argvars, 1) == FAIL
|| (argvars[1].v_type != VAR_UNKNOWN
&& check_for_opt_dict_arg(argvars, 2) == FAIL)))
return;