patch 8.2.4861: it is not easy to restore saved mappings
Problem: It is not easy to restore saved mappings.
Solution: Make mapset() accept a dict argument. (Ernie Rael, closes #10295)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 4456f69..f065026 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -422,6 +422,21 @@
}
/*
+ * Check "type" is a string or a dict of 'any'
+ */
+ static int
+arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
+{
+ if (type->tt_type == VAR_ANY
+ || type->tt_type == VAR_UNKNOWN
+ || type->tt_type == VAR_STRING
+ || type->tt_type == VAR_DICT)
+ return OK;
+ arg_type_mismatch(&t_string, type, context->arg_idx + 1);
+ return FAIL;
+}
+
+/*
* Check "type" is a string or a blob
*/
static int
@@ -998,8 +1013,8 @@
static argcheck_T arg3_string_any_dict[] = {arg_string, NULL, arg_dict_any};
static argcheck_T arg3_string_any_string[] = {arg_string, NULL, arg_string};
static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool};
-static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any};
static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool};
+static argcheck_T arg3_string_or_dict_bool_dict[] = {arg_string_or_dict_any, arg_bool, arg_dict_any};
static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool};
static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any};
static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number};
@@ -2053,7 +2068,7 @@
ret_list_dict_any, f_maplist},
{"mapnew", 2, 2, FEARG_1, arg2_mapnew,
ret_first_cont, f_mapnew},
- {"mapset", 3, 3, FEARG_1, arg3_string_bool_dict,
+ {"mapset", 1, 3, FEARG_1, arg3_string_or_dict_bool_dict,
ret_void, f_mapset},
{"match", 2, 4, FEARG_1, arg24_match_func,
ret_any, f_match},