diff src/map.c @ 29994:86eb4aba16c3 v9.0.0335

patch 9.0.0335: checks for Dictionary argument often give a vague error Commit: https://github.com/vim/vim/commit/04c4c5746e15884768d2cb41370c3276a196cd4c Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Aug 30 19:48:24 2022 +0100 patch 9.0.0335: checks for Dictionary argument often give a vague error Problem: Checks for Dictionary argument often give a vague error message. Solution: Give a useful error message. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11009)
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Aug 2022 21:00:05 +0200
parents fdfb36298114
children 4123e4bd1708
line wrap: on
line diff
--- a/src/map.c
+++ b/src/map.c
@@ -2635,11 +2635,8 @@ f_mapset(typval_T *argvars, typval_T *re
 	    return;
 	is_abbr = (int)tv_get_bool(&argvars[1]);
 
-	if (argvars[2].v_type != VAR_DICT)
-	{
-	    emsg(_(e_dictionary_required));
+	if (check_for_dict_arg(argvars, 2) == FAIL)
 	    return;
-	}
 	d = argvars[2].vval.v_dict;
     }
     mode = get_map_mode_string(which, is_abbr);