Problem: Vim9: confusing error when using function() with a number.
Solution: Check for a function or string argument.
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;
enddef
def Test_function()
+ CheckDefExecAndScriptFailure(['function(123)'], 'E1256: String or function required for argument 1')
+
CheckDefAndScriptFailure(['function("reverse", 2)'], ['E1013: Argument 2: type mismatch, expected list<any> but got number', 'E1211: List required for argument 2'])
CheckDefAndScriptFailure(['function("reverse", [2], [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3'])
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3895,
/**/
3894,
/**/