1
0
forked from aniani/vim

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)
This commit is contained in:
rbtnn
2021-12-18 18:33:46 +00:00
committed by Bram Moolenaar
parent 605ec91e5a
commit 0ccb5842f5
9 changed files with 149 additions and 40 deletions

View File

@@ -464,6 +464,21 @@ arg_list_or_dict_or_blob_or_string(type_T *type, argcontext_T *context)
return FAIL;
}
/*
* 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.
*/
@@ -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};