changeset 31602:53c3df37a2b0 v9.0.1133

patch 9.0.1133: error message names do not match the items Commit: https://github.com/vim/vim/commit/a9fa8c58fbcc5cf8850f6963c509de272f4d4bbf Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 2 18:10:04 2023 +0000 patch 9.0.1133: error message names do not match the items Problem: Error message names do not match the items. Solution: Add "_str" when the text contains "%s".
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Jan 2023 19:15:04 +0100
parents 7282793ec66f
children 2b8fe38a9989
files src/dict.c src/errors.h src/eval.c src/evalfunc.c src/evalvars.c src/highlight.c src/syntax.c src/textprop.c src/undo.c src/userfunc.c src/version.c src/vim9cmds.c src/vim9compile.c src/vim9execute.c src/vim9expr.c src/vim9script.c
diffstat 16 files changed, 62 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -982,7 +982,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    if (*skipwhite(*arg) == ':')
 		semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
 	    else
-		semsg(_(e_missing_colon_in_dictionary), *arg);
+		semsg(_(e_missing_colon_in_dictionary_str), *arg);
 	    clear_tv(&tvkey);
 	    goto failret;
 	}
@@ -1020,7 +1020,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    item = dict_find(d, key, -1);
 	    if (item != NULL)
 	    {
-		semsg(_(e_duplicate_key_in_dictionary), key);
+		semsg(_(e_duplicate_key_in_dictionary_str), key);
 		clear_tv(&tvkey);
 		clear_tv(&tv);
 		goto failret;
@@ -1060,7 +1060,7 @@ eval_dict(char_u **arg, typval_T *rettv,
 	    if (**arg == ',')
 		semsg(_(e_no_white_space_allowed_before_str_str), ",", *arg);
 	    else
-		semsg(_(e_missing_comma_in_dictionary), *arg);
+		semsg(_(e_missing_comma_in_dictionary_str), *arg);
 	    goto failret;
 	}
     }
@@ -1068,7 +1068,7 @@ eval_dict(char_u **arg, typval_T *rettv,
     if (**arg != '}')
     {
 	if (evalarg != NULL)
-	    semsg(_(e_missing_dict_end), *arg);
+	    semsg(_(e_missing_dict_end_str), *arg);
 failret:
 	if (d != NULL)
 	    dict_free(d);
@@ -1456,7 +1456,7 @@ dict_remove(typval_T *argvars, typval_T 
     di = dict_find(d, key, -1);
     if (di == NULL)
     {
-	semsg(_(e_key_not_present_in_dictionary), key);
+	semsg(_(e_key_not_present_in_dictionary_str), key);
 	return;
     }
 
--- a/src/errors.h
+++ b/src/errors.h
@@ -968,9 +968,9 @@ EXTERN char e_couldnt_find_pattern[]
 #ifdef FEAT_SYN_HL
 EXTERN char e_illegal_argument_str_2[]
 	INIT(= N_("E390: Illegal argument: %s"));
-EXTERN char e_no_such_syntax_cluster_1[]
+EXTERN char e_no_such_syntax_cluster_str_1[]
 	INIT(= N_("E391: No such syntax cluster: %s"));
-EXTERN char e_no_such_syntax_cluster_2[]
+EXTERN char e_no_such_syntax_cluster_str_2[]
 	INIT(= N_("E392: No such syntax cluster: %s"));
 EXTERN char e_groupthere_not_accepted_here[]
 	INIT(= N_("E393: group[t]here not accepted here"));
@@ -1028,7 +1028,7 @@ EXTERN char e_fg_color_unknown[]
 	INIT(= N_("E419: FG color unknown"));
 EXTERN char e_bg_color_unknown[]
 	INIT(= N_("E420: BG color unknown"));
-EXTERN char e_color_name_or_number_not_recognized[]
+EXTERN char e_color_name_or_number_not_recognized_str[]
 	INIT(= N_("E421: Color name or number not recognized: %s"));
 EXTERN char e_terminal_code_too_long_str[]
 	INIT(= N_("E422: Terminal code too long: %s"));
@@ -1796,7 +1796,7 @@ EXTERN char e_list_required[]
 	INIT(= N_("E714: List required"));
 EXTERN char e_dictionary_required[]
 	INIT(= N_("E715: Dictionary required"));
-EXTERN char e_key_not_present_in_dictionary[]
+EXTERN char e_key_not_present_in_dictionary_str[]
 	INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
 EXTERN char e_dictionary_entry_already_exists[]
 	INIT(= N_("E717: Dictionary entry already exists"));
@@ -1804,13 +1804,13 @@ EXTERN char e_funcref_required[]
 	INIT(= N_("E718: Funcref required"));
 EXTERN char e_cannot_slice_dictionary[]
 	INIT(= N_("E719: Cannot slice a Dictionary"));
-EXTERN char e_missing_colon_in_dictionary[]
+EXTERN char e_missing_colon_in_dictionary_str[]
 	INIT(= N_("E720: Missing colon in Dictionary: %s"));
-EXTERN char e_duplicate_key_in_dictionary[]
+EXTERN char e_duplicate_key_in_dictionary_str[]
 	INIT(= N_("E721: Duplicate key in Dictionary: \"%s\""));
-EXTERN char e_missing_comma_in_dictionary[]
+EXTERN char e_missing_comma_in_dictionary_str[]
 	INIT(= N_("E722: Missing comma in Dictionary: %s"));
-EXTERN char e_missing_dict_end[]
+EXTERN char e_missing_dict_end_str[]
 	INIT(= N_("E723: Missing end of Dictionary '}': %s"));
 EXTERN char e_variable_nested_too_deep_for_displaying[]
 	INIT(= N_("E724: Variable nested too deep for displaying"));
@@ -2111,7 +2111,7 @@ EXTERN char e_undo_number_nr_not_found[]
 EXTERN char e_bf_key_init_called_with_empty_password[]
 	INIT(= N_("E831: bf_key_init() called with empty password"));
 # ifdef FEAT_PERSISTENT_UNDO
-EXTERN char e_non_encrypted_file_has_encrypted_undo_file[]
+EXTERN char e_non_encrypted_file_has_encrypted_undo_file_str[]
 	INIT(= N_("E832: Non-encrypted file has encrypted undo file: %s"));
 # endif
 #else
@@ -2397,7 +2397,7 @@ EXTERN char e_cannot_use_redir_inside_ex
 EXTERN char e_buffer_cannot_be_registered[]
 	INIT(= N_("E931: Buffer cannot be registered"));
 #ifdef FEAT_EVAL
-EXTERN char e_closure_function_should_not_be_at_top_level[]
+EXTERN char e_closure_function_should_not_be_at_top_level_str[]
 	INIT(= N_("E932: Closure function should not be at top level: %s"));
 EXTERN char e_function_was_deleted_str[]
 	INIT(= N_("E933: Function was deleted: %s"));
@@ -2513,7 +2513,7 @@ EXTERN char e_property_type_str_already_
 	INIT(= N_("E969: Property type %s already defined"));
 EXTERN char e_unknown_highlight_group_name_str[]
 	INIT(= N_("E970: Unknown highlight group name: '%s'"));
-EXTERN char e_type_not_exist[]
+EXTERN char e_property_type_str_does_not_exist[]
 	INIT(= N_("E971: Property type %s does not exist"));
 #endif
 #ifdef FEAT_EVAL
@@ -2634,17 +2634,17 @@ EXTERN char e_invalid_key_str[]
 	INIT(= N_("E1014: Invalid key: %s"));
 EXTERN char e_name_expected_str[]
 	INIT(= N_("E1015: Name expected: %s"));
-EXTERN char e_cannot_declare_a_scope_variable[]
+EXTERN char e_cannot_declare_a_scope_variable_str[]
 	INIT(= N_("E1016: Cannot declare a %s variable: %s"));
-EXTERN char e_cannot_declare_an_environment_variable[]
+EXTERN char e_cannot_declare_an_environment_variable_str[]
 	INIT(= N_("E1016: Cannot declare an environment variable: %s"));
-EXTERN char e_variable_already_declared[]
+EXTERN char e_variable_already_declared_str[]
 	INIT(= N_("E1017: Variable already declared: %s"));
-EXTERN char e_cannot_assign_to_constant[]
+EXTERN char e_cannot_assign_to_constant_str[]
 	INIT(= N_("E1018: Cannot assign to a constant: %s"));
 EXTERN char e_can_only_concatenate_to_string[]
 	INIT(= N_("E1019: Can only concatenate to string"));
-EXTERN char e_cannot_use_operator_on_new_variable[]
+EXTERN char e_cannot_use_operator_on_new_variable_str[]
 	INIT(= N_("E1020: Cannot use an operator on a new variable: %s"));
 EXTERN char e_const_requires_a_value[]
 	INIT(= N_("E1021: Const requires a value"));
@@ -2674,7 +2674,7 @@ EXTERN char e_missing_catch_or_finally[]
 	INIT(= N_("E1032: Missing :catch or :finally"));
 EXTERN char e_catch_unreachable_after_catch_all[]
 	INIT(= N_("E1033: Catch unreachable after catch-all"));
-EXTERN char e_cannot_use_reserved_name[]
+EXTERN char e_cannot_use_reserved_name_str[]
 	INIT(= N_("E1034: Cannot use reserved name %s"));
 EXTERN char e_percent_requires_number_arguments[]
 	// xgettext:no-c-format
@@ -2713,7 +2713,7 @@ EXTERN char e_colon_required_before_rang
 #ifdef FEAT_EVAL
 EXTERN char e_wrong_argument_type_for_plus[]
 	INIT(= N_("E1051: Wrong argument type for +"));
-EXTERN char e_cannot_declare_an_option[]
+EXTERN char e_cannot_declare_an_option_str[]
 	INIT(= N_("E1052: Cannot declare an option: %s"));
 EXTERN char e_could_not_import_str[]
 	INIT(= N_("E1053: Could not import \"%s\""));
@@ -2791,7 +2791,7 @@ EXTERN char e_script_cannot_import_itsel
 	INIT(= N_("E1088: Script cannot import itself"));
 EXTERN char e_unknown_variable_str[]
 	INIT(= N_("E1089: Unknown variable: %s"));
-EXTERN char e_cannot_assign_to_argument[]
+EXTERN char e_cannot_assign_to_argument_str[]
 	INIT(= N_("E1090: Cannot assign to argument %s"));
 EXTERN char e_function_is_not_compiled_str[]
 	INIT(= N_("E1091: Function is not compiled: %s"));
--- a/src/eval.c
+++ b/src/eval.c
@@ -1183,7 +1183,7 @@ get_lval(
     if (vim9script && (flags & GLV_NO_DECL) == 0)
     {
 	if (!quiet)
-	    semsg(_(e_variable_already_declared), lp->ll_name);
+	    semsg(_(e_variable_already_declared_str), lp->ll_name);
 	return NULL;
     }
 
@@ -1413,7 +1413,7 @@ get_lval(
 		if (*p == '[' || *p == '.' || unlet)
 		{
 		    if (!quiet)
-			semsg(_(e_key_not_present_in_dictionary), key);
+			semsg(_(e_key_not_present_in_dictionary_str), key);
 		    clear_tv(&var1);
 		    return NULL;
 		}
@@ -1717,7 +1717,7 @@ set_var_lval(
 	{
 	    if (op != NULL && *op != '=')
 	    {
-		semsg(_(e_key_not_present_in_dictionary), lp->ll_newkey);
+		semsg(_(e_key_not_present_in_dictionary_str), lp->ll_newkey);
 		return;
 	    }
 	    if (dict_wrong_func_name(lp->ll_tv->vval.v_dict, rettv,
@@ -4968,7 +4968,7 @@ eval_index_inner(
 		    {
 			if (keylen > 0)
 			    key[keylen] = NUL;
-			semsg(_(e_key_not_present_in_dictionary), key);
+			semsg(_(e_key_not_present_in_dictionary_str), key);
 		    }
 		    return FAIL;
 		}
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7200,7 +7200,7 @@ f_islocked(typval_T *argvars, typval_T *
 	    else if (lv.ll_range)
 		emsg(_(e_range_not_allowed));
 	    else if (lv.ll_newkey != NULL)
-		semsg(_(e_key_not_present_in_dictionary), lv.ll_newkey);
+		semsg(_(e_key_not_present_in_dictionary_str), lv.ll_newkey);
 	    else if (lv.ll_list != NULL)
 		// List item.
 		rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv);
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1111,7 +1111,8 @@ ex_let(exarg_T *eap)
 		if (vim9script && (flags & ASSIGN_NO_DECL) == 0)
 		{
 		    // +=, /=, etc. require an existing variable
-		    semsg(_(e_cannot_use_operator_on_new_variable), eap->arg);
+		    semsg(_(e_cannot_use_operator_on_new_variable_str),
+								     eap->arg);
 		}
 		else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
 		{
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -1091,7 +1091,7 @@ highlight_set_cterm_color(
 		    break;
 	    if (i < 0)
 	    {
-		semsg(_(e_color_name_or_number_not_recognized), key_start);
+		semsg(_(e_color_name_or_number_not_recognized_str), key_start);
 		return FALSE;
 	    }
 
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3670,7 +3670,7 @@ syn_cmd_clear(exarg_T *eap, int syncing)
 		id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
 		if (id == 0)
 		{
-		    semsg(_(e_no_such_syntax_cluster_1), arg);
+		    semsg(_(e_no_such_syntax_cluster_str_1), arg);
 		    break;
 		}
 		else
@@ -3880,7 +3880,7 @@ syn_cmd_list(
 	    {
 		id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
 		if (id == 0)
-		    semsg(_(e_no_such_syntax_cluster_2), arg);
+		    semsg(_(e_no_such_syntax_cluster_str_2), arg);
 		else
 		    syn_list_cluster(id - SYNID_CLUSTER);
 	    }
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -98,7 +98,7 @@ lookup_prop_type(char_u *name, buf_T *bu
     if (type == NULL)
 	type = find_prop_type(name, NULL);
     if (type == NULL)
-	semsg(_(e_type_not_exist), name);
+	semsg(_(e_property_type_str_does_not_exist), name);
     return type;
 }
 
@@ -1825,7 +1825,7 @@ prop_type_set(typval_T *argvars, int add
     {
 	if (prop == NULL)
 	{
-	    semsg(_(e_type_not_exist), name);
+	    semsg(_(e_property_type_str_does_not_exist), name);
 	    return;
 	}
     }
--- a/src/undo.c
+++ b/src/undo.c
@@ -1923,7 +1923,8 @@ u_read_undo(char_u *name, char_u *hash, 
 #ifdef FEAT_CRYPT
 	if (*curbuf->b_p_key == NUL)
 	{
-	    semsg(_(e_non_encrypted_file_has_encrypted_undo_file), file_name);
+	    semsg(_(e_non_encrypted_file_has_encrypted_undo_file_str),
+								    file_name);
 	    goto error;
 	}
 	bi.bi_state = crypt_create_from_file(fp, curbuf->b_p_key);
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -4599,7 +4599,8 @@ define_function(
 	    if (!aborting())
 	    {
 		if (!eap->skip && fudi.fd_newkey != NULL)
-		    semsg(_(e_key_not_present_in_dictionary), fudi.fd_newkey);
+		    semsg(_(e_key_not_present_in_dictionary_str),
+							       fudi.fd_newkey);
 		vim_free(fudi.fd_newkey);
 		return NULL;
 	    }
@@ -4847,7 +4848,7 @@ define_function(
 		p += 7;
 		if (current_funccal == NULL)
 		{
-		    emsg_funcname(e_closure_function_should_not_be_at_top_level,
+		    emsg_funcname(e_closure_function_should_not_be_at_top_level_str,
 			    name == NULL ? (char_u *)"" : name);
 		    goto erret;
 		}
@@ -6058,7 +6059,7 @@ ex_call(exarg_T *eap)
     if (fudi.fd_newkey != NULL)
     {
 	// Still need to give an error message for missing key.
-	semsg(_(e_key_not_present_in_dictionary), fudi.fd_newkey);
+	semsg(_(e_key_not_present_in_dictionary_str), fudi.fd_newkey);
 	vim_free(fudi.fd_newkey);
     }
     if (tofree == NULL)
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1133,
+/**/
     1132,
 /**/
     1131,
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -1035,7 +1035,7 @@ compile_for(char_u *arg_start, cctx_T *c
 		    goto failed;
 		if (lookup_local(arg, varlen, NULL, cctx) == OK)
 		{
-		    semsg(_(e_variable_already_declared), arg);
+		    semsg(_(e_variable_already_declared_str), arg);
 		    goto failed;
 		}
 
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1314,15 +1314,15 @@ vim9_declare_error(char_u *name)
 	case 'w': scope = _("window"); break;
 	case 't': scope = _("tab"); break;
 	case 'v': scope = "v:"; break;
-	case '$': semsg(_(e_cannot_declare_an_environment_variable), name);
+	case '$': semsg(_(e_cannot_declare_an_environment_variable_str), name);
 		  return;
-	case '&': semsg(_(e_cannot_declare_an_option), name);
+	case '&': semsg(_(e_cannot_declare_an_option_str), name);
 		  return;
 	case '@': semsg(_(e_cannot_declare_a_register_str), name);
 		  return;
 	default: return;
     }
-    semsg(_(e_cannot_declare_a_scope_variable), scope, name);
+    semsg(_(e_cannot_declare_a_scope_variable_str), scope, name);
 }
 
 /*
@@ -1578,7 +1578,7 @@ compile_lhs(
 	    {
 		if (is_decl)
 		{
-		    semsg(_(e_variable_already_declared), lhs->lhs_name);
+		    semsg(_(e_variable_already_declared_str), lhs->lhs_name);
 		    return FAIL;
 		}
 	    }
@@ -1748,7 +1748,7 @@ compile_lhs(
 	if (oplen > 1 && !heredoc)
 	{
 	    // +=, /=, etc. require an existing variable
-	    semsg(_(e_cannot_use_operator_on_new_variable), lhs->lhs_name);
+	    semsg(_(e_cannot_use_operator_on_new_variable_str), lhs->lhs_name);
 	    return FAIL;
 	}
 	if (!is_decl || (lhs->lhs_has_index && !has_cmd
@@ -1851,14 +1851,14 @@ compile_assign_lhs(
 
     if (!lhs->lhs_has_index && lhs->lhs_lvar == &lhs->lhs_arg_lvar)
     {
-	semsg(_(e_cannot_assign_to_argument), lhs->lhs_name);
+	semsg(_(e_cannot_assign_to_argument_str), lhs->lhs_name);
 	return FAIL;
     }
     if (!is_decl && lhs->lhs_lvar != NULL
 			   && lhs->lhs_lvar->lv_const != ASSIGN_VAR
 			   && !lhs->lhs_has_index)
     {
-	semsg(_(e_cannot_assign_to_constant), lhs->lhs_name);
+	semsg(_(e_cannot_assign_to_constant_str), lhs->lhs_name);
 	return FAIL;
     }
     return OK;
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -229,12 +229,11 @@ exe_newdict(int count, ectx_T *ectx)
 	    // have already checked key type is VAR_STRING
 	    tv = STACK_TV_BOT(2 * (idx - count));
 	    // check key is unique
-	    key = tv->vval.v_string == NULL
-				? (char_u *)"" : tv->vval.v_string;
+	    key = tv->vval.v_string == NULL ? (char_u *)"" : tv->vval.v_string;
 	    item = dict_find(dict, key, -1);
 	    if (item != NULL)
 	    {
-		semsg(_(e_duplicate_key_in_dictionary), key);
+		semsg(_(e_duplicate_key_in_dictionary_str), key);
 		dict_unref(dict);
 		return MAYBE;
 	    }
@@ -2386,8 +2385,7 @@ execute_unletindex(isn_T *iptr, ectx_T *
 		if (di == NULL)
 		{
 		    // NULL dict is equivalent to empty dict
-		    semsg(_(e_key_not_present_in_dictionary),
-							  key);
+		    semsg(_(e_key_not_present_in_dictionary_str), key);
 		    status = FAIL;
 		}
 		else if (var_check_fixed(di->di_flags,
@@ -5103,7 +5101,7 @@ exec_instructions(ectx_T *ectx)
 		    if ((di = dict_find(dict, key, -1)) == NULL)
 		    {
 			SOURCING_LNUM = iptr->isn_lnum;
-			semsg(_(e_key_not_present_in_dictionary), key);
+			semsg(_(e_key_not_present_in_dictionary_str), key);
 
 			// If :silent! is used we will continue, make sure the
 			// stack contents makes sense and the dict stack is
@@ -5146,7 +5144,7 @@ exec_instructions(ectx_T *ectx)
 								       == NULL)
 		    {
 			SOURCING_LNUM = iptr->isn_lnum;
-			semsg(_(e_key_not_present_in_dictionary),
+			semsg(_(e_key_not_present_in_dictionary_str),
 							 iptr->isn_arg.string);
 			goto on_error;
 		    }
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -1317,7 +1317,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	    item = dict_find(d, key, -1);
 	    if (item != NULL)
 	    {
-		semsg(_(e_duplicate_key_in_dictionary), key);
+		semsg(_(e_duplicate_key_in_dictionary_str), key);
 		goto failret;
 	    }
 	    item = dictitem_alloc(key);
@@ -1335,7 +1335,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	    if (*skipwhite(*arg) == ':')
 		semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg);
 	    else
-		semsg(_(e_missing_colon_in_dictionary), *arg);
+		semsg(_(e_missing_colon_in_dictionary_str), *arg);
 	    return FAIL;
 	}
 	whitep = *arg + 1;
@@ -1367,7 +1367,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	    break;
 	if (**arg != ',')
 	{
-	    semsg(_(e_missing_comma_in_dictionary), *arg);
+	    semsg(_(e_missing_comma_in_dictionary_str), *arg);
 	    goto failret;
 	}
 	if (IS_WHITE_OR_NUL(*whitep))
@@ -1398,7 +1398,7 @@ compile_dict(char_u **arg, cctx_T *cctx,
 failret:
     if (*arg == NULL)
     {
-	semsg(_(e_missing_dict_end), _("[end of lines]"));
+	semsg(_(e_missing_dict_end_str), _("[end of lines]"));
 	*arg = (char_u *)"";
     }
     dict_unref(d);
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -1138,7 +1138,7 @@ check_reserved_name(char_u *name, cctx_T
 		    && cctx->ctx_ufunc != NULL
 		    && (cctx->ctx_ufunc->uf_flags & FC_OBJECT)))
 	{
-	    semsg(_(e_cannot_use_reserved_name), name);
+	    semsg(_(e_cannot_use_reserved_name_str), name);
 	    return FAIL;
 	}
     return OK;