summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/errors.h202
-rw-r--r--src/eval.c2
-rw-r--r--src/evalvars.c6
-rw-r--r--src/ex_cmds.c4
-rw-r--r--src/ex_docmd.c2
-rw-r--r--src/globals.h2
-rw-r--r--src/match.c2
-rw-r--r--src/scriptfile.c2
-rw-r--r--src/testdir/test_vim9_disassemble.vim2
-rw-r--r--src/testdir/test_vim9_expr.vim42
-rw-r--r--src/testdir/test_vim9_func.vim42
-rw-r--r--src/testdir/test_vim9_script.vim24
-rw-r--r--src/userfunc.c16
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c126
-rw-r--r--src/vim9execute.c24
-rw-r--r--src/vim9script.c35
-rw-r--r--src/vim9type.c16
18 files changed, 369 insertions, 182 deletions
diff --git a/src/errors.h b/src/errors.h
index f61327600..6a2e50ee3 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -11,26 +11,224 @@
*/
#ifdef FEAT_EVAL
+EXTERN char e_undefined_variable_str[]
+ INIT(= N_("E121: Undefined variable: %s"));
+EXTERN char e_undefined_variable_char_str[]
+ INIT(= N_("E121: Undefined variable: %c:%s"));
+#endif
+EXTERN char e_invalid_command[]
+ INIT(= N_("E476: Invalid command"));
+#ifdef FEAT_EVAL
+EXTERN char e_invalid_command_str[]
+ INIT(= N_("E476: Invalid command: %s"));
+EXTERN char e_missing_let_str[]
+ INIT(= N_("E1100: Missing :let: %s"));
+EXTERN char e_variable_not_found_str[]
+ INIT(= N_("E1001: variable not found: %s"));
+EXTERN char e_syntax_error_at_str[]
+ INIT(= N_("E1002: Syntax error at %s"));
+EXTERN char e_missing_return_value[]
+ INIT(= N_("E1003: Missing return value"));
EXTERN char e_white_space_required_before_and_after[]
INIT(= N_("E1004: white space required before and after '%s'"));
+EXTERN char e_too_many_argument_types[]
+ INIT(= N_("E1005: Too many argument types"));
+EXTERN char e_str_is_used_as_argument[]
+ INIT(= N_("E1006: %s is used as an argument"));
+EXTERN char e_mandatory_argument_after_optional_argument[]
+ INIT(= N_("E1007: mandatory argument after optional argument"));
+EXTERN char e_missing_type[]
+ INIT(= N_("E1008: Missing <type>"));
+EXTERN char e_missing_gt_after_type[]
+ INIT(= N_("E1009: Missing > after type"));
+EXTERN char e_type_not_recognized_str[]
+ INIT(= N_("E1010: Type not recognized: %s"));
+EXTERN char e_name_too_long_str[]
+ INIT(= N_("E1011: name too long: %s"));
+EXTERN char e_type_mismatch_expected_str_but_got_str[]
+ INIT(= N_("E1012: type mismatch, expected %s but got %s"));
+EXTERN char e_argument_nr_type_mismatch_expected_str_but_got_str[]
+ INIT(= N_("E1013: argument %d: type mismatch, expected %s but got %s"));
+EXTERN char e_invalid_key_str[]
+ INIT(= N_("E1014: Invalid key: %s"));
+EXTERN char e_name_expected[]
+ INIT(= N_("E1015: Name expected: %s"));
EXTERN char e_cannot_declare_a_scope_variable[]
INIT(= N_("E1016: Cannot declare a %s variable: %s"));
EXTERN char e_cannot_declare_an_environment_variable[]
INIT(= N_("E1016: Cannot declare an environment variable: %s"));
+EXTERN char e_variable_already_declared[]
+ INIT(= N_("E1017: Variable already declared: %s"));
+EXTERN char e_cannot_assign_to_constant[]
+ 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[]
+ 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"));
EXTERN char e_type_or_initialization_required[]
INIT(= N_("E1022: type or initialization required"));
+// E1023 unused
+// E1024 unused
+EXTERN char e_using_rcurly_outside_if_block_scope[]
+ INIT(= N_("E1025: using } outside of a block scope"));
+EXTERN char e_missing_rcurly[]
+ INIT(= N_("E1026: Missing }"));
+EXTERN char e_missing_return_statement[]
+ INIT(= N_("E1027: Missing return statement"));
+EXTERN char e_compile_def_function_failed[]
+ INIT(= N_("E1028: compile_def_function failed"));
+EXTERN char e_expected_str_but_got_str[]
+ INIT(= N_("E1029: Expected %s but got %s"));
+EXTERN char e_using_string_as_number[]
+ INIT(= N_("E1030: Using a String as a Number"));
+EXTERN char e_cannot_use_void_value[]
+ INIT(= N_("E1031: Cannot use void value"));
+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[]
+ INIT(= N_("E1034: Cannot use reserved name %s"));
+EXTERN char e_percent_requires_number_arguments[]
+ INIT(= N_("E1035: % requires number arguments"));
+EXTERN char e_char_requires_number_or_float_arguments[]
+ INIT(= N_("E1036: %c requires number or float arguments"));
+EXTERN char e_cannot_use_str_with_str[]
+ INIT(= N_("E1037: Cannot use \"%s\" with %s"));
+EXTERN char e_vim9script_can_only_be_used_in_script[]
+ INIT(= N_("E1038: vim9script can only be used in a script"));
+EXTERN char e_vim9script_must_be_first_command_in_script[]
+ INIT(= N_("E1039: vim9script must be the first command in a script"));
+EXTERN char e_cannot_use_scriptversion_after_vim9script[]
+ INIT(= N_("E1040: Cannot use :scriptversion after :vim9script"));
+EXTERN char e_redefining_script_item_str[]
+ INIT(= N_("E1041: Redefining script item %s"));
+EXTERN char e_export_can_only_be_used_in_vim9script[]
+ INIT(= N_("E1042: export can only be used in vim9script"));
+EXTERN char e_invalid_command_after_export[]
+ INIT(= N_("E1043: Invalid command after :export"));
+EXTERN char e_export_with_invalid_argument[]
+ INIT(= N_("E1044: export with invalid argument"));
+EXTERN char e_missing_as_after_star[]
+ INIT(= N_("E1045: Missing \"as\" after *"));
+EXTERN char e_missing_comma_in_import[]
+ INIT(= N_("E1046: Missing comma in import"));
+EXTERN char e_syntax_error_in_import[]
+ INIT(= N_("E1047: syntax error in import"));
+EXTERN char e_item_not_found_in_script_str[]
+ INIT(= N_("E1048: Item not found in script: %s"));
+EXTERN char e_item_not_exported_in_script_str[]
+ INIT(= N_("E1049: Item not exported in script: %s"));
EXTERN char e_colon_required_before_a_range[]
INIT(= N_("E1050: Colon required before a range"));
+EXTERN char e_wrong_argument_type_for_plus[]
+ INIT(= N_("E1051: wrong argument type for +"));
+EXTERN char e_cannot_declare_an_option[]
+ INIT(= N_("E1052: Cannot declare an option: %s"));
+EXTERN char e_could_not_import_str[]
+ INIT(= N_("E1053: Could not import \"%s\""));
+EXTERN char e_variable_already_declared_in_script[]
+ INIT(= N_("E1054: Variable already declared in the script: %s"));
+EXTERN char e_missing_name_after_dots[]
+ INIT(= N_("E1055: Missing name after ..."));
+EXTERN char e_expected_type_str[]
+ INIT(= N_("E1056: expected a type: %s"));
+EXTERN char e_missing_enddef[]
+ INIT(= N_("E1057: Missing :enddef"));
+EXTERN char e_function_nesting_too_deep[]
+ INIT(= N_("E1058: function nesting too deep"));
+EXTERN char e_no_white_space_allowed_before_colon_str[]
+ INIT(= N_("E1059: No white space allowed before colon: %s"));
+EXTERN char e_expected_dot_after_name_str[]
+ INIT(= N_("E1060: expected dot after name: %s"));
+EXTERN char e_cannot_find_function_str[]
+ INIT(= N_("E1061: Cannot find function %s"));
+// E1062 unused
+EXTERN char e_type_mismatch_for_v_variable[]
+ INIT(= N_("E1063: type mismatch for v: variable"));
+// E1064 unused
+// E1065 unused
+EXTERN char e_cannot_declare_a_register[]
+ INIT(= N_("E1066: Cannot declare a register: %s"));
+EXTERN char e_separator_mismatch[]
+ INIT(= N_("E1067: Separator mismatch: %s"));
EXTERN char e_no_white_space_allowed_before[]
INIT(= N_("E1068: No white space allowed before '%s'"));
EXTERN char e_white_space_required_after[]
INIT(= N_("E1069: white space required after '%s'"));
+EXTERN char e_missing_from[]
+ INIT(= N_("E1070: Missing \"from\""));
+EXTERN char e_invalid_string_after_from[]
+ INIT(= N_("E1071: Invalid string after \"from\""));
+EXTERN char e_cannot_compare_str_with_str[]
+ INIT(= N_("E1072: Cannot compare %s with %s"));
EXTERN char e_name_already_defined[]
INIT(= N_("E1073: name already defined: %s"));
-EXTERN char e_list_dict_or_blob_required[]
- INIT(= N_("E1090: List, Dict or Blob required"));
+EXTERN char e_no_white_space_allowed_after_dot[]
+ INIT(= N_("E1074: no white space allowed after dot"));
+EXTERN char e_namespace_not_supported_str[]
+ INIT(= N_("E1075: Namespace not supported: %s"));
+EXTERN char e_this_vim_is_not_compiled_with_float_support[]
+ INIT(= N_("E1076: This Vim is not compiled with float support"));
+EXTERN char e_missing_argument_type_for_str[]
+ INIT(= N_("E1077: Missing argument type for %s"));
+// E1078 unused
+// E1079 unused
+// E1080 unused
+EXTERN char e_cannot_unlet_str[]
+ INIT(= N_("E1081: Cannot unlet %s"));
+EXTERN char e_cannot_use_namespaced_variable[]
+ INIT(= N_("E1082: Cannot use a namespaced variable: %s"));
+EXTERN char e_missing_backtick[]
+ INIT(= N_("E1083: missing backtick"));
+EXTERN char e_cannot_delete_vim9_script_function_str[]
+ INIT(= N_("E1084: Cannot delete Vim9 script function %s"));
+EXTERN char e_not_callable_type_str[]
+ INIT(= N_("E1085: Not a callable type: %s"));
+EXTERN char e_cannot_use_function_inside_def[]
+ INIT(= N_("E1086: Cannot use :function inside :def"));
+EXTERN char e_cannot_use_index_when_declaring_variable[]
+ INIT(= N_("E1087: cannot use an index when declaring a variable"));
+// E1088 unused
+EXTERN char e_unknown_variable_str[]
+ INIT(= N_("E1089: unknown variable: %s"));
+EXTERN char e_cannot_assign_to_argument[]
+ INIT(= N_("E1090: Cannot assign to argument %s"));
+EXTERN char e_function_is_not_compiled_str[]
+ INIT(= N_("E1091: Function is not compiled: %s"));
+EXTERN char e_cannot_use_list_for_declaration[]
+ INIT(= N_("E1092: Cannot use a list for a declaration"));
+EXTERN char e_expected_nr_items_but_got_nr[]
+ INIT(= N_("E1093: Expected %d items but got %d"));
+EXTERN char e_import_can_only_be_used_in_script[]
+ INIT(= N_("E1094: import can only be used in a script"));
+EXTERN char e_unreachable_code_after_return[]
+ INIT(= N_("E1095: Unreachable code after :return"));
+EXTERN char e_returning_value_in_function_without_return_type[]
+ INIT(= N_("E1096: Returning a value in a function without a return type"));
+EXTERN char e_line_incomplete[]
+ INIT(= N_("E1097: line incomplete"));
+// E1098 unused
+EXTERN char e_unknown_error_while_executing_str[]
+ INIT(= N_("E1099: Unknown error while executing %s"));
+EXTERN char e_cannot_declare_script_variable_in_function[]
+ INIT(= N_("E1101: Cannot declare a script variable in a function: %s"));
+EXTERN char e_lambda_function_not_found_str[]
+ INIT(= N_("E1102: lambda function not found: %s"));
EXTERN char e_dictionary_not_set[]
INIT(= N_("E1103: Dictionary not set"));
+EXTERN char e_missing_gt[]
+ INIT(= N_("E1104: Missing >"));
+EXTERN char e_cannot_convert_str_to_string[]
+ INIT(= N_("E1105: Cannot convert %s to string"));
+EXTERN char e_one_argument_too_many[]
+ INIT(= N_("E1106: one argument too many"));
+EXTERN char e_nr_arguments_too_many[]
+ INIT(= N_("E1106: %d arguments too many"));
+EXTERN char e_list_dict_or_blob_required[]
+ INIT(= N_("E1107: List, Dict or Blob required"));
+EXTERN char e_item_not_found_str[]
+ INIT(= N_("E1108: Item not found: %s"));
#endif
diff --git a/src/eval.c b/src/eval.c
index 984835b6d..70d5b343d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -858,7 +858,7 @@ get_lval(
v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
- semsg(_(e_undefvar), lp->ll_name);
+ semsg(_(e_undefined_variable_str), lp->ll_name);
*p = cc;
if (v == NULL)
return NULL;
diff --git a/src/evalvars.c b/src/evalvars.c
index d948ddec5..0562b4ce2 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2054,7 +2054,7 @@ set_vim_var_tv(int idx, typval_T *tv)
{
if (vimvars[idx].vv_type != tv->v_type)
{
- emsg(_("E1063: type mismatch for v: variable"));
+ emsg(_(e_type_mismatch_for_v_variable));
clear_tv(tv);
return FAIL;
}
@@ -2442,7 +2442,7 @@ eval_variable(
if (tv == NULL)
{
if (rettv != NULL && verbose)
- semsg(_(e_undefvar), name);
+ semsg(_(e_undefined_variable_str), name);
ret = FAIL;
}
else if (rettv != NULL)
@@ -2945,7 +2945,7 @@ set_var_const(
{
if ((flags & LET_NO_COMMAND) == 0)
{
- semsg(_("E1041: Redefining script item %s"), name);
+ semsg(_(e_redefining_script_item_str), name);
return;
}
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 2550f0e30..c61f57533 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3842,7 +3842,7 @@ ex_substitute(exarg_T *eap)
if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, &regmatch) == FAIL)
{
if (subflags.do_error)
- emsg(_(e_invcmd));
+ emsg(_(e_invalid_command));
return;
}
@@ -4816,7 +4816,7 @@ ex_global(exarg_T *eap)
if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, &regmatch) == FAIL)
{
- emsg(_(e_invcmd));
+ emsg(_(e_invalid_command));
return;
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 87ae5f999..c08524fff 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5978,7 +5978,7 @@ ex_recover(exarg_T *eap)
static void
ex_wrongmodifier(exarg_T *eap)
{
- eap->errmsg = _(e_invcmd);
+ eap->errmsg = _(e_invalid_command);
}
/*
diff --git a/src/globals.h b/src/globals.h
index f3cfb5576..d7d1c08f9 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1588,7 +1588,6 @@ EXTERN char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"))
EXTERN char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
#endif
EXTERN char e_invrange[] INIT(= N_("E16: Invalid range"));
-EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command"));
#if defined(UNIX) || defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
#endif
@@ -1677,7 +1676,6 @@ EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string"));
EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
#ifdef FEAT_EVAL
-EXTERN char e_undefvar[] INIT(= N_("E121: Undefined variable: %s"));
EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
diff --git a/src/match.c b/src/match.c
index 2bb98fe9f..0df7bfe2f 100644
--- a/src/match.c
+++ b/src/match.c
@@ -1296,7 +1296,7 @@ ex_match(exarg_T *eap)
id = eap->line2;
else
{
- emsg(_(e_invcmd));
+ emsg(_(e_invalid_command));
return;
}
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 320340f8d..fee29712c 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1900,7 +1900,7 @@ ex_scriptversion(exarg_T *eap UNUSED)
}
if (in_vim9script())
{
- emsg(_("E1040: Cannot use :scriptversion after :vim9script"));
+ emsg(_(e_cannot_use_scriptversion_after_vim9script));
return;
}
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index fe8afad9a..ef89322df 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -35,7 +35,7 @@ enddef
def Test_disassemble_load()
assert_fails('disass NoFunc', 'E1061:')
- assert_fails('disass NotCompiled', 'E1062:')
+ assert_fails('disass NotCompiled', 'E1091:')
assert_fails('disass', 'E471:')
assert_fails('disass [', 'E475:')
assert_fails('disass 234', 'E129:')
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 38a332601..15c26fd62 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1281,9 +1281,9 @@ func Test_expr6_fails()
call CheckDefFailure(["let x = #{one: 1} / #{two: 2}"], 'E1036:')
call CheckDefFailure(["let x = #{one: 1} % #{two: 2}"], 'E1035:')
- call CheckDefFailure(["let x = 0xff[1]"], 'E1090:')
+ call CheckDefFailure(["let x = 0xff[1]"], 'E1107:')
if has('float')
- call CheckDefFailure(["let x = 0.7[1]"], 'E1090:')
+ call CheckDefFailure(["let x = 0.7[1]"], 'E1107:')
endif
endfunc
@@ -1382,8 +1382,8 @@ def Test_expr7_vimvar()
let old: list<string> = v:oldfiles
let compl: dict<any> = v:completed_item
- call CheckDefFailure(["let old: list<number> = v:oldfiles"], 'E1013: type mismatch, expected list<number> but got list<string>')
- call CheckDefFailure(["let old: dict<number> = v:completed_item"], 'E1013: type mismatch, expected dict<number> but got dict<any>')
+ call CheckDefFailure(["let old: list<number> = v:oldfiles"], 'E1012: type mismatch, expected list<number> but got list<string>')
+ call CheckDefFailure(["let old: dict<number> = v:completed_item"], 'E1012: type mismatch, expected dict<number> but got dict<any>')
enddef
def Test_expr7_special()
@@ -1464,10 +1464,10 @@ def Test_expr7_list()
call CheckDefFailure(["let x = g:list_mixed["], 'E1097:')
call CheckDefFailure(["let x = g:list_mixed[0"], 'E1097:')
call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
- call CheckDefFailure(["let l: list<number> = [234, 'x']"], 'E1013:')
- call CheckDefFailure(["let l: list<number> = ['x', 234]"], 'E1013:')
- call CheckDefFailure(["let l: list<string> = [234, 'x']"], 'E1013:')
- call CheckDefFailure(["let l: list<string> = ['x', 123]"], 'E1013:')
+ call CheckDefFailure(["let l: list<number> = [234, 'x']"], 'E1012:')
+ call CheckDefFailure(["let l: list<number> = ['x', 234]"], 'E1012:')
+ call CheckDefFailure(["let l: list<string> = [234, 'x']"], 'E1012:')
+ call CheckDefFailure(["let l: list<string> = ['x', 123]"], 'E1012:')
enddef
def Test_expr7_list_vim9script()
@@ -1509,22 +1509,22 @@ def Test_expr7_list_vim9script()
vim9script
let l: list<number> = [234, 'x']
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<number> = ['x', 234]
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<string> = ['x', 234]
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<string> = [234, 'x']
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
enddef
def LambdaWithComments(): func
@@ -1652,10 +1652,10 @@ def Test_expr7_dict()
call CheckDefExecFailure(["let x = g:anint.member"], 'E715:')
call CheckDefExecFailure(["let x = g:dict_empty.member"], 'E716:')
- call CheckDefFailure(['let x: dict<number> = #{a: 234, b: "1"}'], 'E1013:')
- call CheckDefFailure(['let x: dict<number> = #{a: "x", b: 134}'], 'E1013:')
- call CheckDefFailure(['let x: dict<string> = #{a: 234, b: "1"}'], 'E1013:')
- call CheckDefFailure(['let x: dict<string> = #{a: "x", b: 134}'], 'E1013:')
+ call CheckDefFailure(['let x: dict<number> = #{a: 234, b: "1"}'], 'E1012:')
+ call CheckDefFailure(['let x: dict<number> = #{a: "x", b: 134}'], 'E1012:')
+ call CheckDefFailure(['let x: dict<string> = #{a: 234, b: "1"}'], 'E1012:')
+ call CheckDefFailure(['let x: dict<string> = #{a: "x", b: 134}'], 'E1012:')
enddef
def Test_expr7_dict_vim9script()
@@ -1720,22 +1720,22 @@ def Test_expr7_dict_vim9script()
vim9script
let l: dict<number> = #{a: 234, b: 'x'}
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<number> = #{a: 'x', b: 234}
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 'x', b: 234}
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 234, b: 'x'}
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
enddef
let g:oneString = 'one'
@@ -2008,7 +2008,7 @@ func Test_expr7_fails()
call CheckDefFailure(["let x = 123->{x -> x + 5) }"], "E451:")
call CheckDefFailure(["let x = &notexist"], 'E113:')
- call CheckDefFailure(["&grepprg = [343]"], 'E1013:')
+ call CheckDefFailure(["&grepprg = [343]"], 'E1012:')
call CheckDefExecFailure(["echo s:doesnt_exist"], 'E121:')
call CheckDefExecFailure(["echo g:doesnt_exist"], 'E121:')
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 75db260ce..38d613ae0 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -269,7 +269,7 @@ def Test_call_def_varargs()
enddef
Func(1, 2, 3)
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
@@ -278,7 +278,7 @@ def Test_call_def_varargs()
enddef
Func('a', 9)
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
@@ -287,7 +287,7 @@ def Test_call_def_varargs()
enddef
Func(1, 'a')
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
enddef
def Test_call_call()
@@ -430,7 +430,7 @@ def Test_call_funcref()
enddef
let Funcref: func(string) = function('UseNumber')
END
- CheckScriptFailure(lines, 'E1013: type mismatch, expected func(string) but got func(number)')
+ CheckScriptFailure(lines, 'E1012: type mismatch, expected func(string) but got func(number)')
lines =<< trim END
vim9script
@@ -682,7 +682,7 @@ def Test_vim9script_call_fail_type()
enddef
MyFunc(1234)
END
- CheckScriptFailure(lines, 'E1013: type mismatch, expected string but got number')
+ CheckScriptFailure(lines, 'E1012: type mismatch, expected string but got number')
enddef
def Test_vim9script_call_fail_const()
@@ -919,41 +919,41 @@ def Test_func_type_part()
let RefVoid: func: void
RefVoid = FuncNoArgNoRet
RefVoid = FuncOneArgNoRet
- CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number')
- CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetString'], 'E1013: type mismatch, expected func() but got func(): string')
+ CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetNumber'], 'E1012: type mismatch, expected func() but got func(): number')
+ CheckDefFailure(['let RefVoid: func: void', 'RefVoid = FuncNoArgRetString'], 'E1012: type mismatch, expected func() but got func(): string')
let RefAny: func(): any
RefAny = FuncNoArgRetNumber
RefAny = FuncNoArgRetString
- CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): any but got func()')
- CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncOneArgNoRet'], 'E1013: type mismatch, expected func(): any but got func(number)')
+ CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 'E1012: type mismatch, expected func(): any but got func()')
+ CheckDefFailure(['let RefAny: func(): any', 'RefAny = FuncOneArgNoRet'], 'E1012: type mismatch, expected func(): any but got func(number)')
let RefNr: func: number
RefNr = FuncNoArgRetNumber
RefNr = FuncOneArgRetNumber
- CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): number but got func()')
- CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgRetString'], 'E1013: type mismatch, expected func(): number but got func(): string')
+ CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgNoRet'], 'E1012: type mismatch, expected func(): number but got func()')
+ CheckDefFailure(['let RefNr: func: number', 'RefNr = FuncNoArgRetString'], 'E1012: type mismatch, expected func(): number but got func(): string')
let RefStr: func: string
RefStr = FuncNoArgRetString
RefStr = FuncOneArgRetString
- CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgNoRet'], 'E1013: type mismatch, expected func(): string but got func()')
- CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func(): string but got func(): number')
+ CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgNoRet'], 'E1012: type mismatch, expected func(): string but got func()')
+ CheckDefFailure(['let RefStr: func: string', 'RefStr = FuncNoArgRetNumber'], 'E1012: type mismatch, expected func(): string but got func(): number')
enddef
def Test_func_type_fails()
CheckDefFailure(['let ref1: func()'], 'E704:')
- CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncNoArgRetNumber'], 'E1013: type mismatch, expected func() but got func(): number')
- CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgNoRet'], 'E1013: type mismatch, expected func() but got func(number)')
- CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgRetNumber'], 'E1013: type mismatch, expected func() but got func(number): number')
- CheckDefFailure(['let Ref1: func(bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(bool) but got func(bool, number)')
- CheckDefFailure(['let Ref1: func(?bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(?bool) but got func(bool, number)')
- CheckDefFailure(['let Ref1: func(...bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1013: type mismatch, expected func(...bool) but got func(bool, number)')
+ CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncNoArgRetNumber'], 'E1012: type mismatch, expected func() but got func(): number')
+ CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgNoRet'], 'E1012: type mismatch, expected func() but got func(number)')
+ CheckDefFailure(['let Ref1: func()', 'Ref1 = FuncOneArgRetNumber'], 'E1012: type mismatch, expected func() but got func(number): number')
+ CheckDefFailure(['let Ref1: func(bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1012: type mismatch, expected func(bool) but got func(bool, number)')
+ CheckDefFailure(['let Ref1: func(?bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1012: type mismatch, expected func(?bool) but got func(bool, number)')
+ CheckDefFailure(['let Ref1: func(...bool)', 'Ref1 = FuncTwoArgNoRet'], 'E1012: type mismatch, expected func(...bool) but got func(bool, number)')
call CheckDefFailure(['let RefWrong: func(string ,number)'], 'E1068:')
call CheckDefFailure(['let RefWrong: func(string,number)'], 'E1069:')
- call CheckDefFailure(['let RefWrong: func(bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool)'], 'E740:')
+ call CheckDefFailure(['let RefWrong: func(bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool)'], 'E1005:')
call CheckDefFailure(['let RefWrong: func(bool):string'], 'E1069:')
enddef
@@ -969,7 +969,7 @@ def Test_func_return_type()
str = FuncOneArgRetAny('yes')
assert_equal('yes', str)
- CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1013: type mismatch, expected string but got number')
+ CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1012: type mismatch, expected string but got number')
enddef
def MultiLine(
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index d8e20e12f..832835ec5 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -31,7 +31,7 @@ def Test_assignment()
call CheckDefFailure(['let lambda = {-> "lambda"}'], 'E704:')
let nr: number = 1234
- call CheckDefFailure(['let nr: number = "asdf"'], 'E1013:')
+ call CheckDefFailure(['let nr: number = "asdf"'], 'E1012:')
let a: number = 6 #comment
assert_equal(6, a)
@@ -100,11 +100,11 @@ def Test_assignment()
call CheckDefFailure(['&notex += 3'], 'E113:')
call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:')
- call CheckDefFailure(['&ts = [7]'], 'E1013:')
+ call CheckDefFailure(['&ts = [7]'], 'E1012:')
call CheckDefExecFailure(['&ts = g:alist'], 'E1029: Expected number but got list')
- call CheckDefFailure(['&ts = "xx"'], 'E1013:')
+ call CheckDefFailure(['&ts = "xx"'], 'E1012:')
call CheckDefExecFailure(['&ts = g:astring'], 'E1029: Expected number but got string')
- call CheckDefFailure(['&path += 3'], 'E1013:')
+ call CheckDefFailure(['&path += 3'], 'E1012:')
call CheckDefExecFailure(['&bs = "asdf"'], 'E474:')
# test freeing ISN_STOREOPT
call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:')
@@ -128,13 +128,13 @@ def Test_assignment()
$SOME_ENV_VAR ..= 'more'
assert_equal('somemore', $SOME_ENV_VAR)
call CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')
- call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1013:')
+ call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1012:')
@a = 'areg'
@a ..= 'add'
assert_equal('aregadd', @a)
call CheckDefFailure(['@a += "more"'], 'E1051:')
- call CheckDefFailure(['@a += 123'], 'E1013:')
+ call CheckDefFailure(['@a += 123'], 'E1012:')
lines =<< trim END
vim9script
@@ -148,7 +148,7 @@ def Test_assignment()
v:errmsg ..= 'again'
assert_equal('noneagain', v:errmsg)
call CheckDefFailure(['v:errmsg += "more"'], 'E1051:')
- call CheckDefFailure(['v:errmsg += 123'], 'E1013:')
+ call CheckDefFailure(['v:errmsg += 123'], 'E1012:')
# single letter variables
a = 123
@@ -538,7 +538,7 @@ def Test_assignment_failure()
call CheckDefFailure(['let anr = 4', 'anr ..= "text"'], 'E1019:')
call CheckDefFailure(['let xnr += 4'], 'E1020:')
- call CheckScriptFailure(['vim9script', 'def Func()', 'let dummy = s:notfound', 'enddef', 'defcompile'], 'E1050:')
+ call CheckScriptFailure(['vim9script', 'def Func()', 'let dummy = s:notfound', 'enddef', 'defcompile'], 'E1108:')
call CheckDefFailure(['let var: list<string> = [123]'], 'expected list<string> but got list<number>')
call CheckDefFailure(['let var: list<number> = ["xx"]'], 'expected list<number> but got list<string>')
@@ -1499,7 +1499,7 @@ def Test_vim9script_fails()
CheckScriptFailure(['vim9script', 'export let g:some'], 'E1022:')
CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:')
- CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1013:')
+ CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1012:')
CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:')
assert_fails('vim9script', 'E1038')
@@ -2218,9 +2218,9 @@ enddef
def Test_for_loop_fails()
CheckDefFailure(['for # in range(5)'], 'E690:')
CheckDefFailure(['for i In range(5)'], 'E690:')
- CheckDefFailure(['let x = 5', 'for x in range(5)'], 'E1023:')
+ CheckDefFailure(['let x = 5', 'for x in range(5)'], 'E1017:')
CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:')
- CheckDefFailure(['for i in "text"'], 'E1013:')
+ CheckDefFailure(['for i in "text"'], 'E1012:')
CheckDefFailure(['for i in xxx'], 'E1001:')
CheckDefFailure(['endfor'], 'E588:')
CheckDefFailure(['for i in range(3)', 'echo 3'], 'E170:')
@@ -2955,7 +2955,7 @@ def Test_let_type_check()
let var: string
var = 1234
END
- CheckScriptFailure(lines, 'E1013:')
+ CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
diff --git a/src/userfunc.c b/src/userfunc.c
index 6c5776992..1b6eff893 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -110,7 +110,7 @@ one_function_arg(char_u *arg, garray_T *newargs, garray_T *argtypes, int skip)
if (VIM_ISWHITE(*p) && *skipwhite(p) == ':')
{
- semsg(_("E1059: No white space allowed before colon: %s"),
+ semsg(_(e_no_white_space_allowed_before_colon_str),
arg_copy == NULL ? arg : arg_copy);
p = skipwhite(p);
}
@@ -128,7 +128,7 @@ one_function_arg(char_u *arg, garray_T *newargs, garray_T *argtypes, int skip)
}
else if (*skipwhite(p) != '=')
{
- semsg(_("E1077: Missing argument type for %s"),
+ semsg(_(e_missing_argument_type_for_str),
arg_copy == NULL ? arg : arg_copy);
return arg;
}
@@ -212,7 +212,7 @@ get_function_args(
// ...name: list<type>
if (!ASCII_ISALPHA(*p))
{
- emsg(_("E1055: Missing name after ..."));
+ emsg(_(e_missing_name_after_dots));
break;
}
@@ -1176,7 +1176,7 @@ copy_func(char_u *lambda, char_u *global)
ufunc_T *fp;
if (ufunc == NULL)
- semsg(_("E1102: lambda function not found: %s"), lambda);
+ semsg(_(e_lambda_function_not_found_str), lambda);
else
{
// TODO: handle ! to overwrite
@@ -2887,7 +2887,7 @@ def_function(exarg_T *eap, char_u *name_arg)
}
else
{
- semsg(_("E1056: expected a type: %s"), ret_type);
+ semsg(_(e_expected_type_str), ret_type);
ret_type = NULL;
}
}
@@ -3018,7 +3018,7 @@ def_function(exarg_T *eap, char_u *name_arg)
if (theline == NULL)
{
if (eap->cmdidx == CMD_def)
- emsg(_("E1057: Missing :enddef"));
+ emsg(_(e_missing_enddef));
else
emsg(_("E126: Missing :endfunction"));
goto erret;
@@ -3119,7 +3119,7 @@ def_function(exarg_T *eap, char_u *name_arg)
if (*skipwhite(p) == '(')
{
if (nesting == MAX_FUNC_NESTING - 1)
- emsg(_("E1058: function nesting too deep"));
+ emsg(_(e_function_nesting_too_deep));
else
{
++nesting;
@@ -3785,7 +3785,7 @@ ex_delfunction(exarg_T *eap)
}
if (fp->uf_flags & FC_VIM9)
{
- semsg(_("E1084: Cannot delete Vim9 script function %s"), eap->arg);
+ semsg(_(e_cannot_delete_vim9_script_function_str), eap->arg);
return;
}
diff --git a/src/version.c b/src/version.c
index 4889fcdf8..06c6995c6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1460,
+/**/
1459,
/**/
1458,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 920628444..11ffee9ad 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -143,13 +143,6 @@ struct cctx_S {
garray_T *ctx_type_list; // list of pointers to allocated types
};
-static char e_var_notfound[] = N_("E1001: variable not found: %s");
-static char e_syntax_at[] = N_("E1002: Syntax error at %s");
-static char e_used_as_arg[] = N_("E1006: %s is used as an argument");
-static char e_cannot_use_void[] = N_("E1031: Cannot use void value");
-static char e_namespace[] = N_("E1075: Namespace not supported: %s");
-static char e_unknown_var[] = N_("E1089: unknown variable: %s");
-
static void delete_def_function_contents(dfunc_T *dfunc);
/*
@@ -431,9 +424,9 @@ check_number_or_float(vartype_T type1, vartype_T type2, char_u *op)
|| type2 == VAR_ANY)))
{
if (*op == '+')
- emsg(_("E1051: wrong argument type for +"));
+ emsg(_(e_wrong_argument_type_for_plus));
else
- semsg(_("E1036: %c requires number or float arguments"), *op);
+ semsg(_(e_char_requires_number_or_float_arguments), *op);
return FAIL;
}
return OK;
@@ -536,7 +529,7 @@ generate_two_op(cctx_T *cctx, char_u *op)
|| (type2->tt_type != VAR_ANY
&& type2->tt_type != VAR_NUMBER))
{
- emsg(_("E1035: % requires number arguments"));
+ emsg(_(e_percent_requires_number_arguments));
return FAIL;
}
isn = generate_instr_drop(cctx,
@@ -604,7 +597,7 @@ get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2)
|| isntype == ISN_COMPARENR
|| isntype == ISN_COMPAREFLOAT))
{
- semsg(_("E1037: Cannot use \"%s\" with %s"),
+ semsg(_(e_cannot_use_str_with_str),
exptype == EXPR_IS ? "is" : "isnot" , vartype_name(type1));
return ISN_DROP;
}
@@ -617,7 +610,7 @@ get_compare_isn(exptype_T exptype, vartype_T type1, vartype_T type2)
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|| type1 == VAR_LIST || type2 == VAR_LIST))))
{
- semsg(_("E1072: Cannot compare %s with %s"),
+ semsg(_(e_cannot_compare_str_with_str),
vartype_name(type1), vartype_name(type2));
return ISN_DROP;
}
@@ -1048,7 +1041,7 @@ generate_LOADV(
if (vidx < 0)
{
if (error)
- semsg(_(e_var_notfound), name);
+ semsg(_(e_variable_not_found_str), name);
return FAIL;
}
type = typval2type_vimvar(get_vim_var_tv(vidx), cctx->ctx_type_list);
@@ -1472,7 +1465,7 @@ generate_PCALL(
}
else
{
- semsg(_("E1085: Not a callable type: %s"), name);
+ semsg(_(e_not_callable_type_str), name);
return FAIL;
}
@@ -1589,7 +1582,7 @@ reserve_local(cctx_T *cctx, char_u *name, size_t len, int isConst, type_T *type)
if (lookup_arg(name, len, NULL, NULL, NULL, cctx) == OK)
{
- emsg_namelen(_(e_used_as_arg), name, (int)len);
+ emsg_namelen(_(e_str_is_used_as_argument), name, (int)len);
return NULL;
}
@@ -1847,7 +1840,7 @@ may_get_next_line_error(char_u *whitep, char_u **arg, cctx_T *cctx)
{
if (may_get_next_line(whitep, arg, cctx) == FAIL)
{
- emsg(_("E1097: line incomplete"));
+ emsg(_(e_line_incomplete));
return FAIL;
}
return OK;
@@ -1993,13 +1986,13 @@ compile_load_scriptvar(
// Used "import * as Name", need to lookup the member.
if (*p != '.')
{
- semsg(_("E1060: expected dot after name: %s"), start);
+ semsg(_(e_expected_dot_after_name_str), start);
return FAIL;
}
++p;
if (VIM_ISWHITE(*p))
{
- emsg(_("E1074: no white space allowed after dot"));
+ emsg(_(e_no_white_space_allowed_after_dot));
return FAIL;
}
@@ -2035,7 +2028,7 @@ compile_load_scriptvar(
}
if (error)
- semsg(_("E1050: Item not found: %s"), name);
+ semsg(_(e_item_not_found_str), name);
return FAIL;
}
@@ -2082,7 +2075,7 @@ compile_load(char_u **arg, char_u *end_arg, cctx_T *cctx, int error)
case 't': isn_type = ISN_LOADTDICT; break;
case 'b': isn_type = ISN_LOADBDICT; break;
default:
- semsg(_(e_namespace), *arg);
+ semsg(_(e_namespace_not_supported_str), *arg);
goto theend;
}
if (generate_instr_type(cctx, isn_type, &t_dict_any) == NULL)
@@ -2108,7 +2101,7 @@ compile_load(char_u **arg, char_u *end_arg, cctx_T *cctx, int error)
case 'w': isn_type = ISN_LOADW; break;
case 't': isn_type = ISN_LOADT; break;
case 'b': isn_type = ISN_LOADB; break;
- default: semsg(_(e_namespace), *arg);
+ default: semsg(_(e_namespace_not_supported_str), *arg);
goto theend;
}
if (isn_type != ISN_DROP)
@@ -2178,7 +2171,7 @@ compile_load(char_u **arg, char_u *end_arg, cctx_T *cctx, int error)
theend:
if (res == FAIL && error && called_emsg == prev_called_emsg)
- semsg(_(e_var_notfound), name);
+ semsg(_(e_variable_not_found_str), name);
vim_free(name);
return res;
}
@@ -2287,7 +2280,7 @@ compile_call(
if (varlen >= sizeof(namebuf))
{
- semsg(_("E1011: name too long: %s"), name);
+ semsg(_(e_name_too_long_str), name);
return FAIL;
}
vim_strncpy(namebuf, *arg, varlen);
@@ -2580,7 +2573,7 @@ compile_dict(char_u **arg, cctx_T *cctx, int literal)
if (end == *arg)
{
- semsg(_("E1014: Invalid key: %s"), *arg);
+ semsg(_(e_invalid_key_str), *arg);
return FAIL;
}
key = vim_strnsave(*arg, end - *arg);
@@ -2733,7 +2726,7 @@ compile_get_env(char_u **arg, cctx_T *cctx)
len = get_env_len(arg);
if (len == 0)
{
- semsg(_(e_syntax_at), start - 1);
+ semsg(_(e_syntax_error_at_str), start - 1);
return FAIL;
}
@@ -2755,7 +2748,7 @@ compile_get_register(char_u **arg, cctx_T *cctx)
++*arg;
if (**arg == NUL)
{
- semsg(_(e_syntax_at), *arg - 1);
+ semsg(_(e_syntax_error_at_str), *arg - 1);
return FAIL;
}
if (!valid_yank_reg(**arg, FALSE))
@@ -3163,7 +3156,7 @@ compile_subscript(
MB_PTR_ADV(p);
if (p == *arg)
{
- semsg(_(e_syntax_at), *arg);
+ semsg(_(e_syntax_error_at_str), *arg);
return FAIL;
}
if (generate_STRINGMEMBER(cctx, *arg, p - *arg) == FAIL)
@@ -3414,7 +3407,7 @@ compile_expr7(
if (!eval_isnamec1(**arg))
{
- semsg(_("E1015: Name expected: %s"), *arg);
+ semsg(_(e_name_expected), *arg);
return FAIL;
}
@@ -3487,7 +3480,7 @@ compile_expr7t(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
if (*skipwhite(*arg) == '>')
semsg(_(e_no_white_space_allowed_before), ">");
else
- emsg(_("E1104: Missing >"));
+ emsg(_(e_missing_gt));
return FAIL;
}
++*arg;
@@ -4106,7 +4099,7 @@ compile_return(char_u *arg, int set_return_type, cctx_T *cctx)
&& stack_type->tt_type != VAR_VOID
&& stack_type->tt_type != VAR_UNKNOWN)
{
- emsg(_("E1096: Returning a value in a function without a return type"));
+ emsg(_(e_returning_value_in_function_without_return_type));
return NULL;
}
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
@@ -4121,7 +4114,7 @@ compile_return(char_u *arg, int set_return_type, cctx_T *cctx)
if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID
&& cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_UNKNOWN)
{
- emsg(_("E1003: Missing return value"));
+ emsg(_(e_missing_return_value));
return NULL;
}
@@ -4177,7 +4170,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
// Only g:Func() can use a namespace.
if (name_start[1] == ':' && !is_global)
{
- semsg(_(e_namespace), name_start);
+ semsg(_(e_namespace_not_supported_str), name_start);
return NULL;
}
if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
@@ -4332,9 +4325,9 @@ vim9_declare_error(char_u *name)
case 'v': scope = "v:"; break;
case '$': semsg(_(e_cannot_declare_an_environment_variable), name);
return;
- case '&': semsg(_("E1052: Cannot declare an option: %s"), name);
+ case '&': semsg(_(e_cannot_declare_an_option), name);
return;
- case '@': semsg(_("E1066: Cannot declare a register: %s"), name);
+ case '@': semsg(_(e_cannot_declare_a_register), name);
return;
default: return;
}
@@ -4380,7 +4373,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
// TODO: should we allow this, and figure out type inference from list
// members?
- emsg(_("E1092: Cannot use a list for a declaration"));
+ emsg(_(e_cannot_use_list_for_declaration));
return NULL;
}
@@ -4440,7 +4433,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
: ((type_T **)stack->ga_data)[stack->ga_len - 1];
if (stacktype->tt_type == VAR_VOID)
{
- emsg(_(e_cannot_use_void));
+ emsg(_(e_cannot_use_void_value));
goto theend;
}
if (need_type(stacktype, &t_list_any, -1, cctx, FALSE) == FAIL)
@@ -4581,7 +4574,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
vimvaridx = find_vim_var(name + 2, &di_flags);
if (vimvaridx < 0)
{
- semsg(_(e_var_notfound), var_start);
+ semsg(_(e_variable_not_found_str), var_start);
goto theend;
}
// We use the current value of "sandbox" here, is that OK?
@@ -4599,7 +4592,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
for (idx = 0; reserved[idx] != NULL; ++idx)
if (STRCMP(reserved[idx], name) == 0)
{
- semsg(_("E1034: Cannot use reserved name %s"), name);
+ semsg(_(e_cannot_use_reserved_name), name);
goto theend;
}
@@ -4613,7 +4606,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
if (is_decl)
{
- semsg(_(e_used_as_arg), name);
+ semsg(_(e_str_is_used_as_argument), name);
goto theend;
}
lvar = &arg_lvar;
@@ -4623,13 +4616,12 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
if (is_decl)
{
- semsg(_("E1017: Variable already declared: %s"), name);
+ semsg(_(e_variable_already_declared), name);
goto theend;
}
else if (lvar->lv_const)
{
- semsg(_("E1018: Cannot assign to a constant: %s"),
- name);
+ semsg(_(e_cannot_assign_to_constant), name);
goto theend;
}
}
@@ -4650,10 +4642,10 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if (is_decl)
{
if (script_namespace)
- semsg(_("E1101: Cannot declare a script variable in a function: %s"),
+ semsg(_(e_cannot_declare_script_variable_in_function),
name);
else
- semsg(_("E1054: Variable already declared in the script: %s"),
+ semsg(_(e_variable_already_declared_in_script),
name);
goto theend;
}
@@ -4662,7 +4654,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
&& script_namespace
&& !script_var && import == NULL)
{
- semsg(_(e_unknown_var), name);
+ semsg(_(e_unknown_variable_str), name);
goto theend;
}
@@ -4685,13 +4677,12 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
}
else if (name[1] == ':' && name[2] != NUL)
{
- semsg(_("E1082: Cannot use a namespaced variable: %s"),
- name);
+ semsg(_(e_cannot_use_namespaced_variable), name);
goto theend;
}
else if (!is_decl)
{
- semsg(_(e_unknown_var), name);
+ semsg(_(e_unknown_variable_str), name);
goto theend;
}
else if (check_defined(var_start, varlen, cctx) == FAIL)
@@ -4732,7 +4723,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
&& type->tt_type != VAR_STRING
&& type->tt_type != VAR_ANY)
{
- emsg(_("E1019: Can only concatenate to string"));
+ emsg(_(e_can_only_concatenate_to_string));
goto theend;
}
@@ -4741,8 +4732,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if (oplen > 1 && !heredoc)
{
// +=, /=, etc. require an existing variable
- semsg(_("E1020: cannot use an operator on a new variable: %s"),
- name);
+ semsg(_(e_cannot_use_operator_on_new_variable), name);
goto theend;
}
@@ -4763,7 +4753,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
// Something follows after the variable: "var[idx]".
if (is_decl)
{
- emsg(_("E1087: cannot use an index when declaring a variable"));
+ emsg(_(e_cannot_use_index_when_declaring_variable));
goto theend;
}
@@ -4783,7 +4773,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
}
else if (lvar == &arg_lvar)
{
- semsg(_("E1090: Cannot assign to argument %s"), name);
+ semsg(_(e_cannot_assign_to_argument), name);
goto theend;
}
@@ -4854,7 +4844,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
if (stacktype->tt_type == VAR_VOID)
{
- emsg(_(e_cannot_use_void));
+ emsg(_(e_cannot_use_void_value));
goto theend;
}
else if ((stacktype->tt_type == VAR_FUNC
@@ -5182,7 +5172,7 @@ check_vim9_unlet(char_u *name)
{
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
- semsg(_("E1081: Cannot unlet %s"), name);
+ semsg(_(e_cannot_unlet_str), name);
return FAIL;
}
return OK;
@@ -5619,7 +5609,7 @@ compile_for(char_u *arg, cctx_T *cctx)
var_lvar = lookup_local(arg, varlen, cctx);
if (var_lvar != NULL)
{
- semsg(_("E1023: variable already defined: %s"), arg);
+ semsg(_(e_variable_already_declared), arg);
return NULL;
}
@@ -5954,7 +5944,7 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
if (scope->se_u.se_try.ts_caught_all)
{
- emsg(_("E1033: catch unreachable after catch-all"));
+ emsg(_(e_catch_unreachable_after_catch_all));
return NULL;
}
@@ -5994,7 +5984,7 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
end = skip_regexp_ex(p + 1, *p, TRUE, &tofree, &dropped);
if (*end != *p)
{
- semsg(_("E1067: Separator mismatch: %s"), p);
+ semsg(_(e_separator_mismatch), p);
vim_free(tofree);
return FAIL;
}
@@ -6099,7 +6089,7 @@ compile_endtry(char_u *arg, cctx_T *cctx)
isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label;
if (isn->isn_arg.try.try_catch == 0 && isn->isn_arg.try.try_finally == 0)
{
- emsg(_("E1032: missing :catch or :finally"));
+ emsg(_(e_missing_catch_or_finally));
return NULL;
}
@@ -6249,7 +6239,7 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
p = skipwhite(p);
if (*p != '`')
{
- emsg(_("E1083: missing backtick"));
+ emsg(_(e_missing_backtick));
return NULL;
}
start = p + 1;
@@ -6493,7 +6483,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
}
else
{
- emsg(_("E1025: using } outside of a block scope"));
+ emsg(_(e_using_rcurly_outside_if_block_scope));
goto erret;
}
if (line != NULL)
@@ -6666,7 +6656,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
{
if (cctx.ctx_had_return)
{
- emsg(_("E1095: Unreachable code after :return"));
+ emsg(_(e_unreachable_code_after_return));
goto erret;
}
}
@@ -6679,7 +6669,9 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
break;
case CMD_function:
- emsg(_("E1086: Cannot use :function inside :def"));
+ // TODO: should we allow this, e.g. to declare a global
+ // function?
+ emsg(_(e_cannot_use_function_inside_def));
goto erret;
case CMD_return:
@@ -6789,7 +6781,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
goto erret;
case CMD_SIZE:
- semsg(_("E476: Invalid command: %s"), ea.cmd);
+ semsg(_(e_invalid_command_str), ea.cmd);
goto erret;
default:
@@ -6818,7 +6810,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
else if (cctx.ctx_scope->se_type == FOR_SCOPE)
emsg(_(e_endfor));
else
- emsg(_("E1026: Missing }"));
+ emsg(_(e_missing_rcurly));
goto erret;
}
@@ -6826,7 +6818,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
{
if (ufunc->uf_ret_type->tt_type != VAR_VOID)
{
- emsg(_("E1027: Missing return statement"));
+ emsg(_(e_missing_return_statement));
goto erret;
}
@@ -6880,7 +6872,7 @@ erret:
if (errormsg != NULL)
emsg(errormsg);
else if (called_emsg == called_emsg_before)
- emsg(_("E1028: compile_def_function failed"));
+ emsg(_(e_compile_def_function_failed));
}
current_sctx = save_current_sctx;
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 424d42a49..2945379b3 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -75,7 +75,7 @@ typedef struct {
void
to_string_error(vartype_T vartype)
{
- semsg(_("E1105: Cannot convert %s to string"), vartype_name(vartype));
+ semsg(_(e_cannot_convert_str_to_string), vartype_name(vartype));
}
/*
@@ -207,9 +207,9 @@ call_dfunc(int cdf_idx, int argcount_arg, ectx_T *ectx)
if (arg_to_add < 0)
{
if (arg_to_add == -1)
- emsg(_("E1106: one argument too many"));
+ emsg(_(e_one_argument_too_many));
else
- semsg(_("E1106: %d arguments too many"), -arg_to_add);
+ semsg(_(e_nr_arguments_too_many), -arg_to_add);
return FAIL;
}
if (ga_grow(&ectx->ec_stack, arg_to_add + 3
@@ -748,7 +748,7 @@ call_def_function(
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
{
if (called_emsg == called_emsg_before)
- semsg(_("E1091: Function is not compiled: %s"),
+ semsg(_(e_function_is_not_compiled_str),
printable_func_name(ufunc));
return FAIL;
}
@@ -1126,7 +1126,7 @@ call_def_function(
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
- semsg(_(e_undefvar), name);
+ semsg(_(e_undefined_variable_str), name);
goto on_error;
}
else
@@ -1175,7 +1175,7 @@ call_def_function(
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
- semsg(_("E121: Undefined variable: %c:%s"),
+ semsg(_(e_undefined_variable_char_str),
namespace, iptr->isn_arg.string);
goto on_error;
}
@@ -2464,7 +2464,7 @@ call_def_function(
&& ct->ct_type == VAR_PARTIAL)))
{
SOURCING_LNUM = iptr->isn_lnum;
- semsg(_("E1029: Expected %s but got %s"),
+ semsg(_(e_expected_str_but_got_str),
vartype_name(ct->ct_type),
vartype_name(tv->v_type));
goto on_error;
@@ -2485,7 +2485,7 @@ call_def_function(
&& !iptr->isn_arg.checklen.cl_more_OK))
{
SOURCING_LNUM = iptr->isn_lnum;
- semsg(_("E1093: Expected %d items but got %d"),
+ semsg(_(e_expected_nr_items_but_got_nr),
min_len, list == NULL ? 0 : list->lv_len);
goto on_error;
}
@@ -2600,7 +2600,7 @@ failed_early:
vim_free(ectx.ec_trystack.ga_data);
if (ret != OK && called_emsg == called_emsg_before)
- semsg(_("E1099: Unknown error while executing %s"),
+ semsg(_(e_unknown_error_while_executing_str),
printable_func_name(ufunc));
return ret;
}
@@ -2650,7 +2650,7 @@ ex_disassemble(exarg_T *eap)
vim_free(fname);
if (ufunc == NULL)
{
- semsg(_("E1061: Cannot find function %s"), eap->arg);
+ semsg(_(e_cannot_find_function_str), eap->arg);
return;
}
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
@@ -2658,7 +2658,7 @@ ex_disassemble(exarg_T *eap)
return;
if (ufunc->uf_def_status != UF_COMPILED)
{
- semsg(_("E1062: Function %s is not compiled"), eap->arg);
+ semsg(_(e_function_is_not_compiled_str), eap->arg);
return;
}
if (ufunc->uf_name_exp != NULL)
@@ -3251,7 +3251,7 @@ check_not_string(typval_T *tv)
{
if (tv->v_type == VAR_STRING)
{
- emsg(_("E1030: Using a String as a Number"));
+ emsg(_(e_using_string_as_number));
clear_tv(tv);
return FAIL;
}
diff --git a/src/vim9script.c b/src/vim9script.c
index c13da69b9..e04c0f0c2 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -17,8 +17,6 @@
#include "vim9.h"
-static char e_needs_vim9[] = N_("E1042: export can only be used in vim9script");
-
int
in_vim9script(void)
{
@@ -38,13 +36,13 @@ ex_vim9script(exarg_T *eap)
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
- emsg(_("E1038: vim9script can only be used in a script"));
+ emsg(_(e_vim9script_can_only_be_used_in_script));
return;
}
si = SCRIPT_ITEM(current_sctx.sc_sid);
if (si->sn_had_command)
{
- emsg(_("E1039: vim9script must be the first command in a script"));
+ emsg(_(e_vim9script_must_be_first_command_in_script));
return;
}
current_sctx.sc_version = SCRIPT_VERSION_VIM9;
@@ -72,7 +70,7 @@ not_in_vim9(exarg_T *eap)
case CMD_insert:
case CMD_t:
case CMD_xit:
- semsg(_("E1100: Missing :let: %s"), eap->cmd);
+ semsg(_(e_missing_let_str), eap->cmd);
return FAIL;
default: break;
}
@@ -90,7 +88,7 @@ ex_export(exarg_T *eap)
{
if (!in_vim9script())
{
- emsg(_(e_needs_vim9));
+ emsg(_(e_export_can_only_be_used_in_vim9script));
return;
}
@@ -109,12 +107,12 @@ ex_export(exarg_T *eap)
// The command will reset "is_export" when exporting an item.
if (is_export)
{
- emsg(_("E1044: export with invalid argument"));
+ emsg(_(e_export_with_invalid_argument));
is_export = FALSE;
}
break;
default:
- emsg(_("E1043: Invalid command after :export"));
+ emsg(_(e_invalid_command_after_export));
break;
}
}
@@ -168,7 +166,7 @@ ex_import(exarg_T *eap)
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
- emsg(_("E1094: import can only be used in a script"));
+ emsg(_(e_import_can_only_be_used_in_script));
return;
}
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
@@ -205,7 +203,7 @@ find_exported(
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
if (!sv->sv_export)
{
- semsg(_("E1049: Item not exported in script: %s"), name);
+ semsg(_(e_item_not_exported_in_script_str), name);
return -1;
}
*type = sv->sv_type;
@@ -235,7 +233,7 @@ find_exported(
if (*ufunc == NULL)
{
- semsg(_("E1048: Item not found in script: %s"), name);
+ semsg(_(e_item_not_found_in_script_str), name);
return -1;
}
}
@@ -264,7 +262,6 @@ handle_import(
int sid = -1;
int res;
garray_T names;
- static char e_import_syntax[] = N_("E1047: syntax error in import");
ga_init2(&names, sizeof(char_u *), 10);
if (*arg == '{')
@@ -298,13 +295,13 @@ handle_import(
}
if (!had_comma)
{
- emsg(_("E1046: Missing comma in import"));
+ emsg(_(e_missing_comma_in_import));
goto erret;
}
}
if (names.ga_len == 0)
{
- emsg(_(e_import_syntax));
+ emsg(_(e_syntax_error_in_import));
goto erret;
}
}
@@ -331,7 +328,7 @@ handle_import(
}
else
{
- emsg(_(e_import_syntax));
+ emsg(_(e_syntax_error_in_import));
goto erret;
}
@@ -352,14 +349,14 @@ handle_import(
}
else if (*arg_start == '*')
{
- emsg(_("E1045: Missing \"as\" after *"));
+ emsg(_(e_missing_as_after_star));
goto erret;
}
}
if (STRNCMP("from", arg, 4) != 0 || !IS_WHITE_OR_NUL(arg[4]))
{
- emsg(_("E1070: Missing \"from\""));
+ emsg(_(e_missing_from));
goto erret;
}
@@ -372,7 +369,7 @@ handle_import(
ret = eval_string(&arg, &tv, TRUE);
if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
{
- emsg(_("E1071: Invalid string after \"from\""));
+ emsg(_(e_invalid_string_after_from));
goto erret;
}
cmd_end = arg;
@@ -427,7 +424,7 @@ handle_import(
if (res == FAIL || sid <= 0)
{
- semsg(_("E1053: Could not import \"%s\""), tv.vval.v_string);
+ semsg(_(e_could_not_import_str), tv.vval.v_string);
clear_tv(&tv);
goto erret;
}
diff --git a/src/vim9type.c b/src/vim9type.c
index 318739bde..1a9b5c27f 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -323,7 +323,7 @@ type_mismatch(type_T *expected, type_T *actual)
{
char *tofree1, *tofree2;
- semsg(_("E1013: type mismatch, expected %s but got %s"),
+ semsg(_(e_type_mismatch_expected_str_but_got_str),
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
vim_free(tofree2);
@@ -334,7 +334,7 @@ arg_type_mismatch(type_T *expected, type_T *actual, int argidx)
{
char *tofree1, *tofree2;
- semsg(_("E1013: argument %d: type mismatch, expected %s but got %s"),
+ semsg(_(e_argument_nr_type_mismatch_expected_str_but_got_str),
argidx,
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
@@ -473,7 +473,7 @@ parse_type_member(char_u **arg, type_T *type, garray_T *type_gap)
if (*skipwhite(*arg) == '<')
semsg(_(e_no_white_space_allowed_before), "<");
else
- emsg(_("E1008: Missing <type>"));
+ emsg(_(e_missing_type));
return type;
}
*arg = skipwhite(*arg + 1);
@@ -483,7 +483,7 @@ parse_type_member(char_u **arg, type_T *type, garray_T *type_gap)
*arg = skipwhite(*arg);
if (**arg != '>' && called_emsg == prev_called_emsg)
{
- emsg(_("E1009: Missing > after type"));
+ emsg(_(e_missing_gt_after_type));
return type;
}
++*arg;
@@ -550,7 +550,7 @@ parse_type(char_u **arg, garray_T *type_gap)
*arg += len;
return &t_float;
#else
- emsg(_("E1076: This Vim is not compiled with float support"));
+ emsg(_(e_this_vim_is_not_compiled_with_float_support));
return &t_any;
#endif
}
@@ -588,7 +588,7 @@ parse_type(char_u **arg, garray_T *type_gap)
}
else if (first_optional != -1)
{
- emsg(_("E1007: mandatory argument after optional argument"));
+ emsg(_(e_mandatory_argument_after_optional_argument));
return &t_any;
}
@@ -615,7 +615,7 @@ parse_type(char_u **arg, garray_T *type_gap)
p = skipwhite(p);
if (argcount == MAX_FUNC_ARGS)
{
- emsg(_("E740: Too many argument types"));
+ emsg(_(e_too_many_argument_types));
return &t_any;
}
}
@@ -695,7 +695,7 @@ parse_type(char_u **arg, garray_T *type_gap)
break;
}
- semsg(_("E1010: Type not recognized: %s"), *arg);
+ semsg(_(e_type_not_recognized_str), *arg);
return &t_any;
}