Patch 8.2.1460
Problem: Error messages are spread out.
Solution: Move more messages into errors.h.
Files: src/errors.h, src/globals.h, src/vim9compile.c, src/vim9execute.c,
src/vim9script.c, src/vim9type.c, src/scriptfile.c, src/ex_cmds.c,
src/ex_docmd.c, src/match.c, src/eval.c, src/evalvars.c,
src/userfunc.c, src/testdir/test_vim9_expr.vim,
src/testdir/test_vim9_disassemble.vim,
src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1459/src/errors.h 2020-08-13 22:47:20.369992748 +0200
--- src/errors.h 2020-08-15 16:16:12.339968096 +0200
***************
*** 11,36 ****
*/
#ifdef FEAT_EVAL
EXTERN char e_white_space_required_before_and_after[]
INIT(= N_("E1004: white space required before and after '%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_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"));
EXTERN char e_colon_required_before_a_range[]
INIT(= N_("E1050: Colon required before a range"));
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_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_dictionary_not_set[]
INIT(= N_("E1103: Dictionary not set"));
#endif
--- 11,234 ----
*/
#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_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
*** ../vim-8.2.1459/src/globals.h 2020-08-13 22:47:20.369992748 +0200
--- src/globals.h 2020-08-15 15:31:57.471555669 +0200
***************
*** 1588,1594 ****
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
--- 1588,1593 ----
***************
*** 1677,1683 ****
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"));
--- 1676,1681 ----
*** ../vim-8.2.1459/src/vim9compile.c 2020-08-14 22:44:20.521878227 +0200
--- src/vim9compile.c 2020-08-15 15:28:39.548598275 +0200
***************
*** 143,155 ****
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);
/*
--- 143,148 ----
***************
*** 431,439 ****
|| type2 == VAR_ANY)))
{
if (*op == '+')
! emsg(_("E1051: wrong argument type for +"));
else
! semsg(_("E1036: %c requires number or float arguments"), *op);
return FAIL;
}
return OK;
--- 424,432 ----
|| type2 == VAR_ANY)))
{
if (*op == '+')
! emsg(_(e_wrong_argument_type_for_plus));
else
! semsg(_(e_char_requires_number_or_float_arguments), *op);
return FAIL;
}
return OK;
***************
*** 536,542 ****
|| (type2->tt_type != VAR_ANY
&& type2->tt_type != VAR_NUMBER))
{
! emsg(_("E1035: % requires number arguments"));
return FAIL;
}
isn = generate_instr_drop(cctx,
--- 529,535 ----
|| (type2->tt_type != VAR_ANY
&& type2->tt_type != VAR_NUMBER))
{
! emsg(_(e_percent_requires_number_arguments));
return FAIL;
}
isn = generate_instr_drop(cctx,
***************
*** 604,610 ****
|| isntype == ISN_COMPARENR
|| isntype == ISN_COMPAREFLOAT))
{
! semsg(_("E1037: Cannot use \"%s\" with %s"),
exptype == EXPR_IS ? "is" : "isnot" , vartype_name(type1));
return ISN_DROP;
}
--- 597,603 ----
|| isntype == ISN_COMPARENR
|| isntype == ISN_COMPAREFLOAT))
{
! semsg(_(e_cannot_use_str_with_str),
exptype == EXPR_IS ? "is" : "isnot" , vartype_name(type1));
return ISN_DROP;
}
***************
*** 617,623 ****
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|| type1 == VAR_LIST || type2 == VAR_LIST))))
{
! semsg(_("E1072: Cannot compare %s with %s"),
vartype_name(type1), vartype_name(type2));
return ISN_DROP;
}
--- 610,616 ----
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|| type1 == VAR_LIST || type2 == VAR_LIST))))
{
! semsg(_(e_cannot_compare_str_with_str),
vartype_name(type1), vartype_name(type2));
return ISN_DROP;
}
***************
*** 1048,1054 ****
if (vidx < 0)
{
if (error)
! semsg(_(e_var_notfound), name);
return FAIL;
}
type = typval2type_vimvar(get_vim_var_tv(vidx), cctx->ctx_type_list);
--- 1041,1047 ----
if (vidx < 0)
{
if (error)
! semsg(_(e_variable_not_found_str), name);
return FAIL;
}
type = typval2type_vimvar(get_vim_var_tv(vidx), cctx->ctx_type_list);
***************
*** 1472,1478 ****
}
else
{
! semsg(_("E1085: Not a callable type: %s"), name);
return FAIL;
}
--- 1465,1471 ----
}
else
{
! semsg(_(e_not_callable_type_str), name);
return FAIL;
}
***************
*** 1589,1595 ****
if (lookup_arg(name, len, NULL, NULL, NULL, cctx) == OK)
{
! emsg_namelen(_(e_used_as_arg), name, (int)len);
return NULL;
}
--- 1582,1588 ----
if (lookup_arg(name, len, NULL, NULL, NULL, cctx) == OK)
{
! emsg_namelen(_(e_str_is_used_as_argument), name, (int)len);
return NULL;
}
***************
*** 1847,1853 ****
{
if (may_get_next_line(whitep, arg, cctx) == FAIL)
{
! emsg(_("E1097: line incomplete"));
return FAIL;
}
return OK;
--- 1840,1846 ----
{
if (may_get_next_line(whitep, arg, cctx) == FAIL)
{
! emsg(_(e_line_incomplete));
return FAIL;
}
return OK;
***************
*** 1993,2005 ****
// Used "import * as Name", need to lookup the member.
if (*p != '.')
{
! semsg(_("E1060: expected dot after name: %s"), start);
return FAIL;
}
++p;
if (VIM_ISWHITE(*p))
{
! emsg(_("E1074: no white space allowed after dot"));
return FAIL;
}
--- 1986,1998 ----
// Used "import * as Name", need to lookup the member.
if (*p != '.')
{
! semsg(_(e_expected_dot_after_name_str), start);
return FAIL;
}
++p;
if (VIM_ISWHITE(*p))
{
! emsg(_(e_no_white_space_allowed_after_dot));
return FAIL;
}
***************
*** 2035,2041 ****
}
if (error)
! semsg(_("E1050: Item not found: %s"), name);
return FAIL;
}
--- 2028,2034 ----
}
if (error)
! semsg(_(e_item_not_found_str), name);
return FAIL;
}
***************
*** 2082,2088 ****
case 't': isn_type = ISN_LOADTDICT; break;
case 'b': isn_type = ISN_LOADBDICT; break;
default:
! semsg(_(e_namespace), *arg);
goto theend;
}
if (generate_instr_type(cctx, isn_type, &t_dict_any) == NULL)
--- 2075,2081 ----
case 't': isn_type = ISN_LOADTDICT; break;
case 'b': isn_type = ISN_LOADBDICT; break;
default:
! semsg(_(e_namespace_not_supported_str), *arg);
goto theend;
}
if (generate_instr_type(cctx, isn_type, &t_dict_any) == NULL)
***************
*** 2108,2114 ****
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);
goto theend;
}
if (isn_type != ISN_DROP)
--- 2101,2107 ----
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_not_supported_str), *arg);
goto theend;
}
if (isn_type != ISN_DROP)
***************
*** 2178,2184 ****
theend:
if (res == FAIL && error && called_emsg == prev_called_emsg)
! semsg(_(e_var_notfound), name);
vim_free(name);
return res;
}
--- 2171,2177 ----
theend:
if (res == FAIL && error && called_emsg == prev_called_emsg)
! semsg(_(e_variable_not_found_str), name);
vim_free(name);
return res;
}
***************
*** 2287,2293 ****
if (varlen >= sizeof(namebuf))
{
! semsg(_("E1011: name too long: %s"), name);
return FAIL;
}
vim_strncpy(namebuf, *arg, varlen);
--- 2280,2286 ----
if (varlen >= sizeof(namebuf))
{
! semsg(_(e_name_too_long_str), name);
return FAIL;
}
vim_strncpy(namebuf, *arg, varlen);
***************
*** 2580,2586 ****
if (end == *arg)
{
! semsg(_("E1014: Invalid key: %s"), *arg);
return FAIL;
}
key = vim_strnsave(*arg, end - *arg);
--- 2573,2579 ----
if (end == *arg)
{
! semsg(_(e_invalid_key_str), *arg);
return FAIL;
}
key = vim_strnsave(*arg, end - *arg);
***************
*** 2733,2739 ****
len = get_env_len(arg);
if (len == 0)
{
! semsg(_(e_syntax_at), start - 1);
return FAIL;
}
--- 2726,2732 ----
len = get_env_len(arg);
if (len == 0)
{
! semsg(_(e_syntax_error_at_str), start - 1);
return FAIL;
}
***************
*** 2755,2761 ****
++*arg;
if (**arg == NUL)
{
! semsg(_(e_syntax_at), *arg - 1);
return FAIL;
}
if (!valid_yank_reg(**arg, FALSE))
--- 2748,2754 ----
++*arg;
if (**arg == NUL)
{
! semsg(_(e_syntax_error_at_str), *arg - 1);
return FAIL;
}
if (!valid_yank_reg(**arg, FALSE))
***************
*** 3163,3169 ****
MB_PTR_ADV(p);
if (p == *arg)
{
! semsg(_(e_syntax_at), *arg);
return FAIL;
}
if (generate_STRINGMEMBER(cctx, *arg, p - *arg) == FAIL)
--- 3156,3162 ----
MB_PTR_ADV(p);
if (p == *arg)
{
! semsg(_(e_syntax_error_at_str), *arg);
return FAIL;
}
if (generate_STRINGMEMBER(cctx, *arg, p - *arg) == FAIL)
***************
*** 3414,3420 ****
if (!eval_isnamec1(**arg))
{
! semsg(_("E1015: Name expected: %s"), *arg);
return FAIL;
}
--- 3407,3413 ----
if (!eval_isnamec1(**arg))
{
! semsg(_(e_name_expected), *arg);
return FAIL;
}
***************
*** 3487,3493 ****
if (*skipwhite(*arg) == '>')
semsg(_(e_no_white_space_allowed_before), ">");
else
! emsg(_("E1104: Missing >"));
return FAIL;
}
++*arg;
--- 3480,3486 ----
if (*skipwhite(*arg) == '>')
semsg(_(e_no_white_space_allowed_before), ">");
else
! emsg(_(e_missing_gt));
return FAIL;
}
++*arg;
***************
*** 4106,4112 ****
&& stack_type->tt_type != VAR_VOID
&& stack_type->tt_type != VAR_UNKNOWN)
{
! emsg(_("E1096: Returning a value in a function without a return type"));
return NULL;
}
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
--- 4099,4105 ----
&& stack_type->tt_type != VAR_VOID
&& stack_type->tt_type != VAR_UNKNOWN)
{
! emsg(_(e_returning_value_in_function_without_return_type));
return NULL;
}
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
***************
*** 4121,4127 ****
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"));
return NULL;
}
--- 4114,4120 ----
if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID
&& cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_UNKNOWN)
{
! emsg(_(e_missing_return_value));
return NULL;
}
***************
*** 4177,4183 ****
// Only g:Func() can use a namespace.
if (name_start[1] == ':' && !is_global)
{
! semsg(_(e_namespace), name_start);
return NULL;
}
if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
--- 4170,4176 ----
// Only g:Func() can use a namespace.
if (name_start[1] == ':' && !is_global)
{
! semsg(_(e_namespace_not_supported_str), name_start);
return NULL;
}
if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
***************
*** 4332,4340 ****
case 'v': scope = "v:"; break;
case '$': semsg(_(e_cannot_declare_an_environment_variable), name);
return;
! case '&': semsg(_("E1052: Cannot declare an option: %s"), name);
return;
! case '@': semsg(_("E1066: Cannot declare a register: %s"), name);
return;
default: return;
}
--- 4325,4333 ----
case 'v': scope = "v:"; break;
case '$': semsg(_(e_cannot_declare_an_environment_variable), name);
return;
! case '&': semsg(_(e_cannot_declare_an_option), name);
return;
! case '@': semsg(_(e_cannot_declare_a_register), name);
return;
default: return;
}
***************
*** 4380,4386 ****
{
// TODO: should we allow this, and figure out type inference from list
// members?
! emsg(_("E1092: Cannot use a list for a declaration"));
return NULL;
}
--- 4373,4379 ----
{
// TODO: should we allow this, and figure out type inference from list
// members?
! emsg(_(e_cannot_use_list_for_declaration));
return NULL;
}
***************
*** 4440,4446 ****
: ((type_T **)stack->ga_data)[stack->ga_len - 1];
if (stacktype->tt_type == VAR_VOID)
{
! emsg(_(e_cannot_use_void));
goto theend;
}
if (need_type(stacktype, &t_list_any, -1, cctx, FALSE) == FAIL)
--- 4433,4439 ----
: ((type_T **)stack->ga_data)[stack->ga_len - 1];
if (stacktype->tt_type == VAR_VOID)
{
! emsg(_(e_cannot_use_void_value));
goto theend;
}
if (need_type(stacktype, &t_list_any, -1, cctx, FALSE) == FAIL)
***************
*** 4581,4587 ****
vimvaridx = find_vim_var(name + 2, &di_flags);
if (vimvaridx < 0)
{
! semsg(_(e_var_notfound), var_start);
goto theend;
}
// We use the current value of "sandbox" here, is that OK?
--- 4574,4580 ----
vimvaridx = find_vim_var(name + 2, &di_flags);
if (vimvaridx < 0)
{
! semsg(_(e_variable_not_found_str), var_start);
goto theend;
}
// We use the current value of "sandbox" here, is that OK?
***************
*** 4599,4605 ****
for (idx = 0; reserved[idx] != NULL; ++idx)
if (STRCMP(reserved[idx], name) == 0)
{
! semsg(_("E1034: Cannot use reserved name %s"), name);
goto theend;
}
--- 4592,4598 ----
for (idx = 0; reserved[idx] != NULL; ++idx)
if (STRCMP(reserved[idx], name) == 0)
{
! semsg(_(e_cannot_use_reserved_name), name);
goto theend;
}
***************
*** 4613,4619 ****
{
if (is_decl)
{
! semsg(_(e_used_as_arg), name);
goto theend;
}
lvar = &arg_lvar;
--- 4606,4612 ----
{
if (is_decl)
{
! semsg(_(e_str_is_used_as_argument), name);
goto theend;
}
lvar = &arg_lvar;
***************
*** 4623,4635 ****
{
if (is_decl)
{
! semsg(_("E1017: Variable already declared: %s"), name);
goto theend;
}
else if (lvar->lv_const)
{
! semsg(_("E1018: Cannot assign to a constant: %s"),
! name);
goto theend;
}
}
--- 4616,4627 ----
{
if (is_decl)
{
! semsg(_(e_variable_already_declared), name);
goto theend;
}
else if (lvar->lv_const)
{
! semsg(_(e_cannot_assign_to_constant), name);
goto theend;
}
}
***************
*** 4650,4659 ****
if (is_decl)
{
if (script_namespace)
! semsg(_("E1101: Cannot declare a script variable in a function: %s"),
name);
else
! semsg(_("E1054: Variable already declared in the script: %s"),
name);
goto theend;
}
--- 4642,4651 ----
if (is_decl)
{
if (script_namespace)
! semsg(_(e_cannot_declare_script_variable_in_function),
name);
else
! semsg(_(e_variable_already_declared_in_script),
name);
goto theend;
}
***************
*** 4662,4668 ****
&& script_namespace
&& !script_var && import == NULL)
{
! semsg(_(e_unknown_var), name);
goto theend;
}
--- 4654,4660 ----
&& script_namespace
&& !script_var && import == NULL)
{
! semsg(_(e_unknown_variable_str), name);
goto theend;
}
***************
*** 4685,4697 ****
}
else if (name[1] == ':' && name[2] != NUL)
{
! semsg(_("E1082: Cannot use a namespaced variable: %s"),
! name);
goto theend;
}
else if (!is_decl)
{
! semsg(_(e_unknown_var), name);
goto theend;
}
else if (check_defined(var_start, varlen, cctx) == FAIL)
--- 4677,4688 ----
}
else if (name[1] == ':' && name[2] != NUL)
{
! semsg(_(e_cannot_use_namespaced_variable), name);
goto theend;
}
else if (!is_decl)
{
! semsg(_(e_unknown_variable_str), name);
goto theend;
}
else if (check_defined(var_start, varlen, cctx) == FAIL)
***************
*** 4732,4738 ****
&& type->tt_type != VAR_STRING
&& type->tt_type != VAR_ANY)
{
! emsg(_("E1019: Can only concatenate to string"));
goto theend;
}
--- 4723,4729 ----
&& type->tt_type != VAR_STRING
&& type->tt_type != VAR_ANY)
{
! emsg(_(e_can_only_concatenate_to_string));
goto theend;
}
***************
*** 4741,4748 ****
if (oplen > 1 && !heredoc)
{
// +=, /=, etc. require an existing variable
! semsg(_("E1020: cannot use an operator on a new variable: %s"),
! name);
goto theend;
}
--- 4732,4738 ----
if (oplen > 1 && !heredoc)
{
// +=, /=, etc. require an existing variable
! semsg(_(e_cannot_use_operator_on_new_variable), name);
goto theend;
}
***************
*** 4763,4769 ****
// Something follows after the variable: "var[idx]".
if (is_decl)
{
! emsg(_("E1087: cannot use an index when declaring a variable"));
goto theend;
}
--- 4753,4759 ----
// Something follows after the variable: "var[idx]".
if (is_decl)
{
! emsg(_(e_cannot_use_index_when_declaring_variable));
goto theend;
}
***************
*** 4783,4789 ****
}
else if (lvar == &arg_lvar)
{
! semsg(_("E1090: Cannot assign to argument %s"), name);
goto theend;
}
--- 4773,4779 ----
}
else if (lvar == &arg_lvar)
{
! semsg(_(e_cannot_assign_to_argument), name);
goto theend;
}
***************
*** 4854,4860 ****
{
if (stacktype->tt_type == VAR_VOID)
{
! emsg(_(e_cannot_use_void));
goto theend;
}
else if ((stacktype->tt_type == VAR_FUNC
--- 4844,4850 ----
{
if (stacktype->tt_type == VAR_VOID)
{
! emsg(_(e_cannot_use_void_value));
goto theend;
}
else if ((stacktype->tt_type == VAR_FUNC
***************
*** 5182,5188 ****
{
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
! semsg(_("E1081: Cannot unlet %s"), name);
return FAIL;
}
return OK;
--- 5172,5178 ----
{
if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
! semsg(_(e_cannot_unlet_str), name);
return FAIL;
}
return OK;
***************
*** 5619,5625 ****
var_lvar = lookup_local(arg, varlen, cctx);
if (var_lvar != NULL)
{
! semsg(_("E1023: variable already defined: %s"), arg);
return NULL;
}
--- 5609,5615 ----
var_lvar = lookup_local(arg, varlen, cctx);
if (var_lvar != NULL)
{
! semsg(_(e_variable_already_declared), arg);
return NULL;
}
***************
*** 5954,5960 ****
if (scope->se_u.se_try.ts_caught_all)
{
! emsg(_("E1033: catch unreachable after catch-all"));
return NULL;
}
--- 5944,5950 ----
if (scope->se_u.se_try.ts_caught_all)
{
! emsg(_(e_catch_unreachable_after_catch_all));
return NULL;
}
***************
*** 5994,6000 ****
end = skip_regexp_ex(p + 1, *p, TRUE, &tofree, &dropped);
if (*end != *p)
{
! semsg(_("E1067: Separator mismatch: %s"), p);
vim_free(tofree);
return FAIL;
}
--- 5984,5990 ----
end = skip_regexp_ex(p + 1, *p, TRUE, &tofree, &dropped);
if (*end != *p)
{
! semsg(_(e_separator_mismatch), p);
vim_free(tofree);
return FAIL;
}
***************
*** 6099,6105 ****
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"));
return NULL;
}
--- 6089,6095 ----
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(_(e_missing_catch_or_finally));
return NULL;
}
***************
*** 6249,6255 ****
p = skipwhite(p);
if (*p != '`')
{
! emsg(_("E1083: missing backtick"));
return NULL;
}
start = p + 1;
--- 6239,6245 ----
p = skipwhite(p);
if (*p != '`')
{
! emsg(_(e_missing_backtick));
return NULL;
}
start = p + 1;
***************
*** 6493,6499 ****
}
else
{
! emsg(_("E1025: using } outside of a block scope"));
goto erret;
}
if (line != NULL)
--- 6483,6489 ----
}
else
{
! emsg(_(e_using_rcurly_outside_if_block_scope));
goto erret;
}
if (line != NULL)
***************
*** 6666,6672 ****
{
if (cctx.ctx_had_return)
{
! emsg(_("E1095: Unreachable code after :return"));
goto erret;
}
}
--- 6656,6662 ----
{
if (cctx.ctx_had_return)
{
! emsg(_(e_unreachable_code_after_return));
goto erret;
}
}
***************
*** 6679,6685 ****
break;
case CMD_function:
! emsg(_("E1086: Cannot use :function inside :def"));
goto erret;
case CMD_return:
--- 6669,6677 ----
break;
case CMD_function:
! // 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,6795 ****
goto erret;
case CMD_SIZE:
! semsg(_("E476: Invalid command: %s"), ea.cmd);
goto erret;
default:
--- 6781,6787 ----
goto erret;
case CMD_SIZE:
! semsg(_(e_invalid_command_str), ea.cmd);
goto erret;
default:
***************
*** 6818,6824 ****
else if (cctx.ctx_scope->se_type == FOR_SCOPE)
emsg(_(e_endfor));
else
! emsg(_("E1026: Missing }"));
goto erret;
}
--- 6810,6816 ----
else if (cctx.ctx_scope->se_type == FOR_SCOPE)
emsg(_(e_endfor));
else
! emsg(_(e_missing_rcurly));
goto erret;
}
***************
*** 6826,6832 ****
{
if (ufunc->uf_ret_type->tt_type != VAR_VOID)
{
! emsg(_("E1027: Missing return statement"));
goto erret;
}
--- 6818,6824 ----
{
if (ufunc->uf_ret_type->tt_type != VAR_VOID)
{
! emsg(_(e_missing_return_statement));
goto erret;
}
***************
*** 6880,6886 ****
if (errormsg != NULL)
emsg(errormsg);
else if (called_emsg == called_emsg_before)
! emsg(_("E1028: compile_def_function failed"));
}
current_sctx = save_current_sctx;
--- 6872,6878 ----
if (errormsg != NULL)
emsg(errormsg);
else if (called_emsg == called_emsg_before)
! emsg(_(e_compile_def_function_failed));
}
current_sctx = save_current_sctx;
*** ../vim-8.2.1459/src/vim9execute.c 2020-08-15 13:49:12.105034605 +0200
--- src/vim9execute.c 2020-08-15 15:38:53.845194622 +0200
***************
*** 75,81 ****
void
to_string_error(vartype_T vartype)
{
! semsg(_("E1105: Cannot convert %s to string"), vartype_name(vartype));
}
/*
--- 75,81 ----
void
to_string_error(vartype_T vartype)
{
! semsg(_(e_cannot_convert_str_to_string), vartype_name(vartype));
}
/*
***************
*** 207,215 ****
if (arg_to_add < 0)
{
if (arg_to_add == -1)
! emsg(_("E1106: one argument too many"));
else
! semsg(_("E1106: %d arguments too many"), -arg_to_add);
return FAIL;
}
if (ga_grow(&ectx->ec_stack, arg_to_add + 3
--- 207,215 ----
if (arg_to_add < 0)
{
if (arg_to_add == -1)
! emsg(_(e_one_argument_too_many));
else
! semsg(_(e_nr_arguments_too_many), -arg_to_add);
return FAIL;
}
if (ga_grow(&ectx->ec_stack, arg_to_add + 3
***************
*** 748,754 ****
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
{
if (called_emsg == called_emsg_before)
! semsg(_("E1091: Function is not compiled: %s"),
printable_func_name(ufunc));
return FAIL;
}
--- 748,754 ----
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
{
if (called_emsg == called_emsg_before)
! semsg(_(e_function_is_not_compiled_str),
printable_func_name(ufunc));
return FAIL;
}
***************
*** 1126,1132 ****
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_(e_undefvar), name);
goto on_error;
}
else
--- 1126,1132 ----
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_(e_undefined_variable_str), name);
goto on_error;
}
else
***************
*** 1175,1181 ****
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_("E121: Undefined variable: %c:%s"),
namespace, iptr->isn_arg.string);
goto on_error;
}
--- 1175,1181 ----
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_(e_undefined_variable_char_str),
namespace, iptr->isn_arg.string);
goto on_error;
}
***************
*** 2464,2470 ****
&& ct->ct_type == VAR_PARTIAL)))
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_("E1029: Expected %s but got %s"),
vartype_name(ct->ct_type),
vartype_name(tv->v_type));
goto on_error;
--- 2464,2470 ----
&& ct->ct_type == VAR_PARTIAL)))
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_(e_expected_str_but_got_str),
vartype_name(ct->ct_type),
vartype_name(tv->v_type));
goto on_error;
***************
*** 2485,2491 ****
&& !iptr->isn_arg.checklen.cl_more_OK))
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_("E1093: Expected %d items but got %d"),
min_len, list == NULL ? 0 : list->lv_len);
goto on_error;
}
--- 2485,2491 ----
&& !iptr->isn_arg.checklen.cl_more_OK))
{
SOURCING_LNUM = iptr->isn_lnum;
! semsg(_(e_expected_nr_items_but_got_nr),
min_len, list == NULL ? 0 : list->lv_len);
goto on_error;
}
***************
*** 2600,2606 ****
vim_free(ectx.ec_trystack.ga_data);
if (ret != OK && called_emsg == called_emsg_before)
! semsg(_("E1099: Unknown error while executing %s"),
printable_func_name(ufunc));
return ret;
}
--- 2600,2606 ----
vim_free(ectx.ec_trystack.ga_data);
if (ret != OK && called_emsg == called_emsg_before)
! semsg(_(e_unknown_error_while_executing_str),
printable_func_name(ufunc));
return ret;
}
***************
*** 2650,2656 ****
vim_free(fname);
if (ufunc == NULL)
{
! semsg(_("E1061: Cannot find function %s"), eap->arg);
return;
}
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
--- 2650,2656 ----
vim_free(fname);
if (ufunc == NULL)
{
! semsg(_(e_cannot_find_function_str), eap->arg);
return;
}
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
***************
*** 2658,2664 ****
return;
if (ufunc->uf_def_status != UF_COMPILED)
{
! semsg(_("E1062: Function %s is not compiled"), eap->arg);
return;
}
if (ufunc->uf_name_exp != NULL)
--- 2658,2664 ----
return;
if (ufunc->uf_def_status != UF_COMPILED)
{
! semsg(_(e_function_is_not_compiled_str), eap->arg);
return;
}
if (ufunc->uf_name_exp != NULL)
***************
*** 3251,3257 ****
{
if (tv->v_type == VAR_STRING)
{
! emsg(_("E1030: Using a String as a Number"));
clear_tv(tv);
return FAIL;
}
--- 3251,3257 ----
{
if (tv->v_type == VAR_STRING)
{
! emsg(_(e_using_string_as_number));
clear_tv(tv);
return FAIL;
}
*** ../vim-8.2.1459/src/vim9script.c 2020-08-13 22:47:20.377992734 +0200
--- src/vim9script.c 2020-08-15 16:15:45.556127577 +0200
***************
*** 17,24 ****
#include "vim9.h"
- static char e_needs_vim9[] = N_("E1042: export can only be used in vim9script");
-
int
in_vim9script(void)
{
--- 17,22 ----
***************
*** 38,50 ****
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
! emsg(_("E1038: vim9script can only be used in a 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"));
return;
}
current_sctx.sc_version = SCRIPT_VERSION_VIM9;
--- 36,48 ----
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
! emsg(_(e_vim9script_can_only_be_used_in_script));
return;
}
si = SCRIPT_ITEM(current_sctx.sc_sid);
if (si->sn_had_command)
{
! emsg(_(e_vim9script_must_be_first_command_in_script));
return;
}
current_sctx.sc_version = SCRIPT_VERSION_VIM9;
***************
*** 72,78 ****
case CMD_insert:
case CMD_t:
case CMD_xit:
! semsg(_("E1100: Missing :let: %s"), eap->cmd);
return FAIL;
default: break;
}
--- 70,76 ----
case CMD_insert:
case CMD_t:
case CMD_xit:
! semsg(_(e_missing_let_str), eap->cmd);
return FAIL;
default: break;
}
***************
*** 90,96 ****
{
if (!in_vim9script())
{
! emsg(_(e_needs_vim9));
return;
}
--- 88,94 ----
{
if (!in_vim9script())
{
! emsg(_(e_export_can_only_be_used_in_vim9script));
return;
}
***************
*** 109,120 ****
// The command will reset "is_export" when exporting an item.
if (is_export)
{
! emsg(_("E1044: export with invalid argument"));
is_export = FALSE;
}
break;
default:
! emsg(_("E1043: Invalid command after :export"));
break;
}
}
--- 107,118 ----
// The command will reset "is_export" when exporting an item.
if (is_export)
{
! emsg(_(e_export_with_invalid_argument));
is_export = FALSE;
}
break;
default:
! emsg(_(e_invalid_command_after_export));
break;
}
}
***************
*** 168,174 ****
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
! emsg(_("E1094: import can only be used in a script"));
return;
}
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
--- 166,172 ----
if (!getline_equal(eap->getline, eap->cookie, getsourceline))
{
! emsg(_(e_import_can_only_be_used_in_script));
return;
}
fill_evalarg_from_eap(&evalarg, eap, eap->skip);
***************
*** 205,211 ****
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
if (!sv->sv_export)
{
! semsg(_("E1049: Item not exported in script: %s"), name);
return -1;
}
*type = sv->sv_type;
--- 203,209 ----
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
if (!sv->sv_export)
{
! semsg(_(e_item_not_exported_in_script_str), name);
return -1;
}
*type = sv->sv_type;
***************
*** 235,241 ****
if (*ufunc == NULL)
{
! semsg(_("E1048: Item not found in script: %s"), name);
return -1;
}
}
--- 233,239 ----
if (*ufunc == NULL)
{
! semsg(_(e_item_not_found_in_script_str), name);
return -1;
}
}
***************
*** 264,270 ****
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 == '{')
--- 262,267 ----
***************
*** 298,310 ****
}
if (!had_comma)
{
! emsg(_("E1046: Missing comma in import"));
goto erret;
}
}
if (names.ga_len == 0)
{
! emsg(_(e_import_syntax));
goto erret;
}
}
--- 295,307 ----
}
if (!had_comma)
{
! emsg(_(e_missing_comma_in_import));
goto erret;
}
}
if (names.ga_len == 0)
{
! emsg(_(e_syntax_error_in_import));
goto erret;
}
}
***************
*** 331,337 ****
}
else
{
! emsg(_(e_import_syntax));
goto erret;
}
--- 328,334 ----
}
else
{
! emsg(_(e_syntax_error_in_import));
goto erret;
}
***************
*** 352,365 ****
}
else if (*arg_start == '*')
{
! emsg(_("E1045: Missing \"as\" after *"));
goto erret;
}
}
if (STRNCMP("from", arg, 4) != 0 || !IS_WHITE_OR_NUL(arg[4]))
{
! emsg(_("E1070: Missing \"from\""));
goto erret;
}
--- 349,362 ----
}
else if (*arg_start == '*')
{
! emsg(_(e_missing_as_after_star));
goto erret;
}
}
if (STRNCMP("from", arg, 4) != 0 || !IS_WHITE_OR_NUL(arg[4]))
{
! emsg(_(e_missing_from));
goto erret;
}
***************
*** 372,378 ****
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\""));
goto erret;
}
cmd_end = arg;
--- 369,375 ----
ret = eval_string(&arg, &tv, TRUE);
if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
{
! emsg(_(e_invalid_string_after_from));
goto erret;
}
cmd_end = arg;
***************
*** 427,433 ****
if (res == FAIL || sid <= 0)
{
! semsg(_("E1053: Could not import \"%s\""), tv.vval.v_string);
clear_tv(&tv);
goto erret;
}
--- 424,430 ----
if (res == FAIL || sid <= 0)
{
! semsg(_(e_could_not_import_str), tv.vval.v_string);
clear_tv(&tv);
goto erret;
}
*** ../vim-8.2.1459/src/vim9type.c 2020-08-14 21:27:34.093321698 +0200
--- src/vim9type.c 2020-08-15 16:08:11.102795598 +0200
***************
*** 323,329 ****
{
char *tofree1, *tofree2;
! semsg(_("E1013: type mismatch, expected %s but got %s"),
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
vim_free(tofree2);
--- 323,329 ----
{
char *tofree1, *tofree2;
! semsg(_(e_type_mismatch_expected_str_but_got_str),
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
vim_free(tofree2);
***************
*** 334,340 ****
{
char *tofree1, *tofree2;
! semsg(_("E1013: argument %d: type mismatch, expected %s but got %s"),
argidx,
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
--- 334,340 ----
{
char *tofree1, *tofree2;
! semsg(_(e_argument_nr_type_mismatch_expected_str_but_got_str),
argidx,
type_name(expected, &tofree1), type_name(actual, &tofree2));
vim_free(tofree1);
***************
*** 473,479 ****
if (*skipwhite(*arg) == '<')
semsg(_(e_no_white_space_allowed_before), "<");
else
! emsg(_("E1008: Missing <type>"));
return type;
}
*arg = skipwhite(*arg + 1);
--- 473,479 ----
if (*skipwhite(*arg) == '<')
semsg(_(e_no_white_space_allowed_before), "<");
else
! emsg(_(e_missing_type));
return type;
}
*arg = skipwhite(*arg + 1);
***************
*** 483,489 ****
*arg = skipwhite(*arg);
if (**arg != '>' && called_emsg == prev_called_emsg)
{
! emsg(_("E1009: Missing > after type"));
return type;
}
++*arg;
--- 483,489 ----
*arg = skipwhite(*arg);
if (**arg != '>' && called_emsg == prev_called_emsg)
{
! emsg(_(e_missing_gt_after_type));
return type;
}
++*arg;
***************
*** 550,556 ****
*arg += len;
return &t_float;
#else
! emsg(_("E1076: This Vim is not compiled with float support"));
return &t_any;
#endif
}
--- 550,556 ----
*arg += len;
return &t_float;
#else
! emsg(_(e_this_vim_is_not_compiled_with_float_support));
return &t_any;
#endif
}
***************
*** 588,594 ****
}
else if (first_optional != -1)
{
! emsg(_("E1007: mandatory argument after optional argument"));
return &t_any;
}
--- 588,594 ----
}
else if (first_optional != -1)
{
! emsg(_(e_mandatory_argument_after_optional_argument));
return &t_any;
}
***************
*** 615,621 ****
p = skipwhite(p);
if (argcount == MAX_FUNC_ARGS)
{
! emsg(_("E740: Too many argument types"));
return &t_any;
}
}
--- 615,621 ----
p = skipwhite(p);
if (argcount == MAX_FUNC_ARGS)
{
! emsg(_(e_too_many_argument_types));
return &t_any;
}
}
***************
*** 695,701 ****
break;
}
! semsg(_("E1010: Type not recognized: %s"), *arg);
return &t_any;
}
--- 695,701 ----
break;
}
! semsg(_(e_type_not_recognized_str), *arg);
return &t_any;
}
*** ../vim-8.2.1459/src/scriptfile.c 2020-08-12 15:21:18.970700474 +0200
--- src/scriptfile.c 2020-08-15 15:49:52.857242456 +0200
***************
*** 1900,1906 ****
}
if (in_vim9script())
{
! emsg(_("E1040: Cannot use :scriptversion after :vim9script"));
return;
}
--- 1900,1906 ----
}
if (in_vim9script())
{
! emsg(_(e_cannot_use_scriptversion_after_vim9script));
return;
}
*** ../vim-8.2.1459/src/ex_cmds.c 2020-08-12 21:58:08.996049839 +0200
--- src/ex_cmds.c 2020-08-15 15:11:35.742985548 +0200
***************
*** 3842,3848 ****
if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, ®match) == FAIL)
{
if (subflags.do_error)
! emsg(_(e_invcmd));
return;
}
--- 3842,3848 ----
if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, ®match) == FAIL)
{
if (subflags.do_error)
! emsg(_(e_invalid_command));
return;
}
***************
*** 4816,4822 ****
if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, ®match) == FAIL)
{
! emsg(_(e_invcmd));
return;
}
--- 4816,4822 ----
if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, ®match) == FAIL)
{
! emsg(_(e_invalid_command));
return;
}
*** ../vim-8.2.1459/src/ex_docmd.c 2020-08-13 22:47:20.373992741 +0200
--- src/ex_docmd.c 2020-08-15 15:11:58.102839312 +0200
***************
*** 5978,5984 ****
static void
ex_wrongmodifier(exarg_T *eap)
{
! eap->errmsg = _(e_invcmd);
}
/*
--- 5978,5984 ----
static void
ex_wrongmodifier(exarg_T *eap)
{
! eap->errmsg = _(e_invalid_command);
}
/*
*** ../vim-8.2.1459/src/match.c 2020-07-23 16:36:59.828375424 +0200
--- src/match.c 2020-08-15 15:12:00.978820506 +0200
***************
*** 1296,1302 ****
id = eap->line2;
else
{
! emsg(_(e_invcmd));
return;
}
--- 1296,1302 ----
id = eap->line2;
else
{
! emsg(_(e_invalid_command));
return;
}
*** ../vim-8.2.1459/src/eval.c 2020-08-12 22:18:19.121805947 +0200
--- src/eval.c 2020-08-15 15:32:31.659369044 +0200
***************
*** 858,864 ****
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);
*p = cc;
if (v == NULL)
return NULL;
--- 858,864 ----
v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
! semsg(_(e_undefined_variable_str), lp->ll_name);
*p = cc;
if (v == NULL)
return NULL;
*** ../vim-8.2.1459/src/evalvars.c 2020-08-15 14:31:17.095317714 +0200
--- src/evalvars.c 2020-08-15 16:01:16.389114765 +0200
***************
*** 2054,2060 ****
{
if (vimvars[idx].vv_type != tv->v_type)
{
! emsg(_("E1063: type mismatch for v: variable"));
clear_tv(tv);
return FAIL;
}
--- 2054,2060 ----
{
if (vimvars[idx].vv_type != tv->v_type)
{
! emsg(_(e_type_mismatch_for_v_variable));
clear_tv(tv);
return FAIL;
}
***************
*** 2442,2448 ****
if (tv == NULL)
{
if (rettv != NULL && verbose)
! semsg(_(e_undefvar), name);
ret = FAIL;
}
else if (rettv != NULL)
--- 2442,2448 ----
if (tv == NULL)
{
if (rettv != NULL && verbose)
! semsg(_(e_undefined_variable_str), name);
ret = FAIL;
}
else if (rettv != NULL)
***************
*** 2945,2951 ****
{
if ((flags & LET_NO_COMMAND) == 0)
{
! semsg(_("E1041: Redefining script item %s"), name);
return;
}
--- 2945,2951 ----
{
if ((flags & LET_NO_COMMAND) == 0)
{
! semsg(_(e_redefining_script_item_str), name);
return;
}
*** ../vim-8.2.1459/src/userfunc.c 2020-08-14 17:08:12.008859508 +0200
--- src/userfunc.c 2020-08-15 16:12:37.429241846 +0200
***************
*** 110,116 ****
if (VIM_ISWHITE(*p) && *skipwhite(p) == ':')
{
! semsg(_("E1059: No white space allowed before colon: %s"),
arg_copy == NULL ? arg : arg_copy);
p = skipwhite(p);
}
--- 110,116 ----
if (VIM_ISWHITE(*p) && *skipwhite(p) == ':')
{
! semsg(_(e_no_white_space_allowed_before_colon_str),
arg_copy == NULL ? arg : arg_copy);
p = skipwhite(p);
}
***************
*** 128,134 ****
}
else if (*skipwhite(p) != '=')
{
! semsg(_("E1077: Missing argument type for %s"),
arg_copy == NULL ? arg : arg_copy);
return arg;
}
--- 128,134 ----
}
else if (*skipwhite(p) != '=')
{
! semsg(_(e_missing_argument_type_for_str),
arg_copy == NULL ? arg : arg_copy);
return arg;
}
***************
*** 212,218 ****
// ...name: list<type>
if (!ASCII_ISALPHA(*p))
{
! emsg(_("E1055: Missing name after ..."));
break;
}
--- 212,218 ----
// ...name: list<type>
if (!ASCII_ISALPHA(*p))
{
! emsg(_(e_missing_name_after_dots));
break;
}
***************
*** 1176,1182 ****
ufunc_T *fp;
if (ufunc == NULL)
! semsg(_("E1102: lambda function not found: %s"), lambda);
else
{
// TODO: handle ! to overwrite
--- 1176,1182 ----
ufunc_T *fp;
if (ufunc == NULL)
! semsg(_(e_lambda_function_not_found_str), lambda);
else
{
// TODO: handle ! to overwrite
***************
*** 2887,2893 ****
}
else
{
! semsg(_("E1056: expected a type: %s"), ret_type);
ret_type = NULL;
}
}
--- 2887,2893 ----
}
else
{
! semsg(_(e_expected_type_str), ret_type);
ret_type = NULL;
}
}
***************
*** 3018,3024 ****
if (theline == NULL)
{
if (eap->cmdidx == CMD_def)
! emsg(_("E1057: Missing :enddef"));
else
emsg(_("E126: Missing :endfunction"));
goto erret;
--- 3018,3024 ----
if (theline == NULL)
{
if (eap->cmdidx == CMD_def)
! emsg(_(e_missing_enddef));
else
emsg(_("E126: Missing :endfunction"));
goto erret;
***************
*** 3119,3125 ****
if (*skipwhite(p) == '(')
{
if (nesting == MAX_FUNC_NESTING - 1)
! emsg(_("E1058: function nesting too deep"));
else
{
++nesting;
--- 3119,3125 ----
if (*skipwhite(p) == '(')
{
if (nesting == MAX_FUNC_NESTING - 1)
! emsg(_(e_function_nesting_too_deep));
else
{
++nesting;
***************
*** 3785,3791 ****
}
if (fp->uf_flags & FC_VIM9)
{
! semsg(_("E1084: Cannot delete Vim9 script function %s"), eap->arg);
return;
}
--- 3785,3791 ----
}
if (fp->uf_flags & FC_VIM9)
{
! semsg(_(e_cannot_delete_vim9_script_function_str), eap->arg);
return;
}
*** ../vim-8.2.1459/src/testdir/test_vim9_expr.vim 2020-08-14 22:44:20.521878227 +0200
--- src/testdir/test_vim9_expr.vim 2020-08-15 16:25:08.268750427 +0200
***************
*** 1281,1289 ****
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:')
if has('float')
! call CheckDefFailure(["let x = 0.7[1]"], 'E1090:')
endif
endfunc
--- 1281,1289 ----
call CheckDefFailure(["let x = #{one: 1} / #{two: 2}"], 'E1036:')
call CheckDefFailure(["let x = #{one: 1} % #{two: 2}"], 'E1035:')
! call CheckDefFailure(["let x = 0xff[1]"], 'E1107:')
if has('float')
! call CheckDefFailure(["let x = 0.7[1]"], 'E1107:')
endif
endfunc
***************
*** 1382,1389 ****
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>')
enddef
def Test_expr7_special()
--- 1382,1389 ----
let old: list<string> = v:oldfiles
let compl: dict<any> = v:completed_item
! 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,1473 ****
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:')
enddef
def Test_expr7_list_vim9script()
--- 1464,1473 ----
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']"], '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,1530 ****
vim9script
let l: list<number> = [234, 'x']
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: list<number> = ['x', 234]
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: list<string> = ['x', 234]
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: list<string> = [234, 'x']
END
! CheckScriptFailure(lines, 'E1013:')
enddef
def LambdaWithComments(): func
--- 1509,1530 ----
vim9script
let l: list<number> = [234, 'x']
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<number> = ['x', 234]
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<string> = ['x', 234]
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: list<string> = [234, 'x']
END
! CheckScriptFailure(lines, 'E1012:')
enddef
def LambdaWithComments(): func
***************
*** 1652,1661 ****
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:')
enddef
def Test_expr7_dict_vim9script()
--- 1652,1661 ----
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"}'], '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,1741 ****
vim9script
let l: dict<number> = #{a: 234, b: 'x'}
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: dict<number> = #{a: 'x', b: 234}
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 'x', b: 234}
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 234, b: 'x'}
END
! CheckScriptFailure(lines, 'E1013:')
enddef
let g:oneString = 'one'
--- 1720,1741 ----
vim9script
let l: dict<number> = #{a: 234, b: 'x'}
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<number> = #{a: 'x', b: 234}
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 'x', b: 234}
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
let l: dict<string> = #{a: 234, b: 'x'}
END
! CheckScriptFailure(lines, 'E1012:')
enddef
let g:oneString = 'one'
***************
*** 2008,2014 ****
call CheckDefFailure(["let x = 123->{x -> x + 5) }"], "E451:")
call CheckDefFailure(["let x = ¬exist"], 'E113:')
! call CheckDefFailure(["&grepprg = [343]"], 'E1013:')
call CheckDefExecFailure(["echo s:doesnt_exist"], 'E121:')
call CheckDefExecFailure(["echo g:doesnt_exist"], 'E121:')
--- 2008,2014 ----
call CheckDefFailure(["let x = 123->{x -> x + 5) }"], "E451:")
call CheckDefFailure(["let x = ¬exist"], 'E113:')
! call CheckDefFailure(["&grepprg = [343]"], 'E1012:')
call CheckDefExecFailure(["echo s:doesnt_exist"], 'E121:')
call CheckDefExecFailure(["echo g:doesnt_exist"], 'E121:')
*** ../vim-8.2.1459/src/testdir/test_vim9_disassemble.vim 2020-08-12 21:34:43.270489452 +0200
--- src/testdir/test_vim9_disassemble.vim 2020-08-15 16:24:20.837036687 +0200
***************
*** 35,41 ****
def Test_disassemble_load()
assert_fails('disass NoFunc', 'E1061:')
! assert_fails('disass NotCompiled', 'E1062:')
assert_fails('disass', 'E471:')
assert_fails('disass [', 'E475:')
assert_fails('disass 234', 'E129:')
--- 35,41 ----
def Test_disassemble_load()
assert_fails('disass NoFunc', 'E1061:')
! assert_fails('disass NotCompiled', 'E1091:')
assert_fails('disass', 'E471:')
assert_fails('disass [', 'E475:')
assert_fails('disass 234', 'E129:')
*** ../vim-8.2.1459/src/testdir/test_vim9_func.vim 2020-08-14 18:56:41.740716995 +0200
--- src/testdir/test_vim9_func.vim 2020-08-15 16:30:19.354869244 +0200
***************
*** 269,275 ****
enddef
Func(1, 2, 3)
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
--- 269,275 ----
enddef
Func(1, 2, 3)
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
***************
*** 278,284 ****
enddef
Func('a', 9)
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
--- 278,284 ----
enddef
Func('a', 9)
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
***************
*** 287,293 ****
enddef
Func(1, 'a')
END
! CheckScriptFailure(lines, 'E1013:')
enddef
def Test_call_call()
--- 287,293 ----
enddef
Func(1, 'a')
END
! CheckScriptFailure(lines, 'E1012:')
enddef
def Test_call_call()
***************
*** 430,436 ****
enddef
let Funcref: func(string) = function('UseNumber')
END
! CheckScriptFailure(lines, 'E1013: type mismatch, expected func(string) but got func(number)')
lines =<< trim END
vim9script
--- 430,436 ----
enddef
let Funcref: func(string) = function('UseNumber')
END
! CheckScriptFailure(lines, 'E1012: type mismatch, expected func(string) but got func(number)')
lines =<< trim END
vim9script
***************
*** 682,688 ****
enddef
MyFunc(1234)
END
! CheckScriptFailure(lines, 'E1013: type mismatch, expected string but got number')
enddef
def Test_vim9script_call_fail_const()
--- 682,688 ----
enddef
MyFunc(1234)
END
! CheckScriptFailure(lines, 'E1012: type mismatch, expected string but got number')
enddef
def Test_vim9script_call_fail_const()
***************
*** 919,959 ****
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')
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)')
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')
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')
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)')
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):string'], 'E1069:')
enddef
--- 919,959 ----
let RefVoid: func: void
RefVoid = FuncNoArgNoRet
RefVoid = FuncOneArgNoRet
! 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'], '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'], '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'], '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'], '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)'], 'E1005:')
call CheckDefFailure(['let RefWrong: func(bool):string'], 'E1069:')
enddef
***************
*** 969,975 ****
str = FuncOneArgRetAny('yes')
assert_equal('yes', str)
! CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1013: type mismatch, expected string but got number')
enddef
def MultiLine(
--- 969,975 ----
str = FuncOneArgRetAny('yes')
assert_equal('yes', str)
! CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1012: type mismatch, expected string but got number')
enddef
def MultiLine(
*** ../vim-8.2.1459/src/testdir/test_vim9_script.vim 2020-08-15 14:31:17.095317714 +0200
--- src/testdir/test_vim9_script.vim 2020-08-15 16:32:21.266130715 +0200
***************
*** 31,37 ****
call CheckDefFailure(['let lambda = {-> "lambda"}'], 'E704:')
let nr: number = 1234
! call CheckDefFailure(['let nr: number = "asdf"'], 'E1013:')
let a: number = 6 #comment
assert_equal(6, a)
--- 31,37 ----
call CheckDefFailure(['let lambda = {-> "lambda"}'], 'E704:')
let nr: number = 1234
! call CheckDefFailure(['let nr: number = "asdf"'], 'E1012:')
let a: number = 6 #comment
assert_equal(6, a)
***************
*** 100,110 ****
call CheckDefFailure(['¬ex += 3'], 'E113:')
call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:')
! call CheckDefFailure(['&ts = [7]'], 'E1013:')
call CheckDefExecFailure(['&ts = g:alist'], 'E1029: Expected number but got list')
! call CheckDefFailure(['&ts = "xx"'], 'E1013:')
call CheckDefExecFailure(['&ts = g:astring'], 'E1029: Expected number but got string')
! call CheckDefFailure(['&path += 3'], 'E1013:')
call CheckDefExecFailure(['&bs = "asdf"'], 'E474:')
# test freeing ISN_STOREOPT
call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:')
--- 100,110 ----
call CheckDefFailure(['¬ex += 3'], 'E113:')
call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:')
! call CheckDefFailure(['&ts = [7]'], 'E1012:')
call CheckDefExecFailure(['&ts = g:alist'], 'E1029: Expected number but got list')
! call CheckDefFailure(['&ts = "xx"'], 'E1012:')
call CheckDefExecFailure(['&ts = g:astring'], 'E1029: Expected number but got string')
! call CheckDefFailure(['&path += 3'], 'E1012:')
call CheckDefExecFailure(['&bs = "asdf"'], 'E474:')
# test freeing ISN_STOREOPT
call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:')
***************
*** 128,140 ****
$SOME_ENV_VAR ..= 'more'
assert_equal('somemore', $SOME_ENV_VAR)
call CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')
! call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1013:')
@a = 'areg'
@a ..= 'add'
assert_equal('aregadd', @a)
call CheckDefFailure(['@a += "more"'], 'E1051:')
! call CheckDefFailure(['@a += 123'], 'E1013:')
lines =<< trim END
vim9script
--- 128,140 ----
$SOME_ENV_VAR ..= 'more'
assert_equal('somemore', $SOME_ENV_VAR)
call CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')
! call CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1012:')
@a = 'areg'
@a ..= 'add'
assert_equal('aregadd', @a)
call CheckDefFailure(['@a += "more"'], 'E1051:')
! call CheckDefFailure(['@a += 123'], 'E1012:')
lines =<< trim END
vim9script
***************
*** 148,154 ****
v:errmsg ..= 'again'
assert_equal('noneagain', v:errmsg)
call CheckDefFailure(['v:errmsg += "more"'], 'E1051:')
! call CheckDefFailure(['v:errmsg += 123'], 'E1013:')
# single letter variables
a = 123
--- 148,154 ----
v:errmsg ..= 'again'
assert_equal('noneagain', v:errmsg)
call CheckDefFailure(['v:errmsg += "more"'], 'E1051:')
! call CheckDefFailure(['v:errmsg += 123'], 'E1012:')
# single letter variables
a = 123
***************
*** 538,544 ****
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 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>')
--- 538,544 ----
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'], '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,1505 ****
CheckScriptFailure(['vim9script', 'export let g:some'], 'E1022:')
CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:')
! CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1013:')
CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:')
assert_fails('vim9script', 'E1038')
--- 1499,1505 ----
CheckScriptFailure(['vim9script', 'export let g:some'], 'E1022:')
CheckScriptFailure(['vim9script', 'export echo 134'], 'E1043:')
! CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1012:')
CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:')
assert_fails('vim9script', 'E1038')
***************
*** 2218,2226 ****
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:')
CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:')
! CheckDefFailure(['for i in "text"'], 'E1013:')
CheckDefFailure(['for i in xxx'], 'E1001:')
CheckDefFailure(['endfor'], 'E588:')
CheckDefFailure(['for i in range(3)', 'echo 3'], 'E170:')
--- 2218,2226 ----
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)'], 'E1017:')
CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:')
! 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,2961 ****
let var: string
var = 1234
END
! CheckScriptFailure(lines, 'E1013:')
lines =<< trim END
vim9script
--- 2955,2961 ----
let var: string
var = 1234
END
! CheckScriptFailure(lines, 'E1012:')
lines =<< trim END
vim9script
*** ../vim-8.2.1459/src/version.c 2020-08-15 14:31:17.095317714 +0200
--- src/version.c 2020-08-15 16:13:10.045049481 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1460,
/**/
--
Your mouse has moved. Windows must be restarted for the change
to take effect. Reboot now?
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///