summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorrbtnn <naru123456789@gmail.com>2021-12-18 18:33:46 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-18 18:33:46 +0000
commit0ccb5842f5fb103763d106c7aa364d758343c35a (patch)
tree76ea36f2abf5035e3695132e0cc5b59e2e9a325c /src/evalfunc.c
parent605ec91e5a7330d61be313637e495fa02a6dc264 (diff)
patch 8.2.3848: cannot use reduce() for a stringv8.2.3848
Problem: Cannot use reduce() for a string. Solution: Make reduce() work with a string. (Naruhiko Nishino, closes #9366)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 12236f73a5..e670381859 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -465,6 +465,21 @@ arg_list_or_dict_or_blob_or_string(type_T *type, argcontext_T *context)
}
/*
+ * 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 arg2_mapfilter[] = {arg_list_or_dict_or_blob_or_string, NULL};
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};