patch 8.2.3848: cannot use reduce() for a string
Problem: Cannot use reduce() for a string.
Solution: Make reduce() work with a string. (Naruhiko Nishino, closes #9366)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 12236f7..e670381 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -465,6 +465,21 @@
}
/*
+ * Check "type" is a list of 'any' or a blob or a string.
+ */
+ static int
+arg_string_list_or_blob(type_T *type, argcontext_T *context)
+{
+ if (type->tt_type == VAR_ANY
+ || type->tt_type == VAR_LIST
+ || type->tt_type == VAR_BLOB
+ || type->tt_type == VAR_STRING)
+ return OK;
+ arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
+ return FAIL;
+}
+
+/*
* Check "type" is a job.
*/
static int
@@ -817,7 +832,7 @@
static argcheck_T arg25_matchadd[] = {arg_string, arg_string, arg_number, arg_number, arg_dict_any};
static argcheck_T arg25_matchaddpos[] = {arg_string, arg_list_any, arg_number, arg_number, arg_dict_any};
static argcheck_T arg119_printf[] = {arg_string_or_nr, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
-static argcheck_T arg23_reduce[] = {arg_list_or_blob, NULL, NULL};
+static argcheck_T arg23_reduce[] = {arg_string_list_or_blob, NULL, NULL};
static argcheck_T arg24_remote_expr[] = {arg_string, arg_string, arg_string, arg_number};
static argcheck_T arg23_remove[] = {arg_list_or_dict_or_blob, arg_remove2, arg_number};
static argcheck_T arg2_repeat[] = {arg_repeat1, arg_number};