# HG changeset patch # User Christian Brabandt # Date 1695934803 -7200 # Node ID 5c12ca4dcd4597e000c6d89935236884d2f755ad # Parent 0ca269de511d5405f5b88b7e9abbe10035cee09b patch 9.0.1950: Vim9: error codes spread out Commit: https://github.com/vim/vim/commit/413f83990f15d5d59d27ab741670f527a7a3feb8 Author: Yegappan Lakshmanan Date: Thu Sep 28 22:46:37 2023 +0200 patch 9.0.1950: Vim9: error codes spread out Problem: Vim9: error codes spread out Solution: group them together and reserve 100 more for future use Reserve 100 error codes for future enhancements to the Vim9 class support closes: #13207 Signed-off-by: Christian Brabandt Co-authored-by: Yegappan Lakshmanan diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6830,55 +6830,55 @@ printf({fmt}, {expr1} ...) *printf()* echo printf("%1$*2$.*3$f", 1.4142135, 6, 2) < 1.41 - *E1400* + *E1500* You cannot mix positional and non-positional arguments: > echo printf("%s%1$s", "One", "Two") -< E1400: Cannot mix positional and non-positional +< E1500: Cannot mix positional and non-positional arguments: %s%1$s - *E1401* + *E1501* You cannot skip a positional argument in a format string: > echo printf("%3$s%1$s", "One", "Two", "Three") -< E1401: format argument 2 unused in $-style +< E1501: format argument 2 unused in $-style format: %3$s%1$s - *E1402* + *E1502* You can re-use a [field-width] (or [precision]) argument: > echo printf("%1$d at width %2$d is: %01$*2$d", 1, 2) < 1 at width 2 is: 01 However, you can't use it as a different type: > echo printf("%1$d at width %2$ld is: %01$*2$d", 1, 2) -< E1402: Positional argument 2 used as field +< E1502: Positional argument 2 used as field width reused as different type: long int/int - *E1403* + *E1503* When a positional argument is used, but not the correct number or arguments is given, an error is raised: > echo printf("%1$d at width %2$d is: %01$*2$.*3$d", 1, 2) -< E1403: Positional argument 3 out of bounds: +< E1503: Positional argument 3 out of bounds: %1$d at width %2$d is: %01$*2$.*3$d Only the first error is reported: > echo printf("%01$*2$.*3$d %4$d", 1, 2) -< E1403: Positional argument 3 out of bounds: +< E1503: Positional argument 3 out of bounds: %01$*2$.*3$d %4$d - *E1404* + *E1504* A positional argument can be used more than once: > echo printf("%1$s %2$s %1$s", "One", "Two") < One Two One However, you can't use a different type the second time: > echo printf("%1$s %2$s %1$d", "One", "Two") -< E1404: Positional argument 1 type used +< E1504: Positional argument 1 type used inconsistently: int/string - *E1405* + *E1505* Various other errors that lead to a format string being wrongly formatted lead to: > echo printf("%1$d at width %2$d is: %01$*2$.3$d", 1, 2) -< E1405: Invalid format specifier: +< E1505: Invalid format specifier: %1$d at width %2$d is: %01$*2$.3$d prompt_getprompt({buf}) *prompt_getprompt()* diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4485,12 +4485,6 @@ E1389 vim9class.txt /*E1389* E139 message.txt /*E139* E1390 vim9class.txt /*E1390* E140 message.txt /*E140* -E1400 builtin.txt /*E1400* -E1401 builtin.txt /*E1401* -E1402 builtin.txt /*E1402* -E1403 builtin.txt /*E1403* -E1404 builtin.txt /*E1404* -E1405 builtin.txt /*E1405* E141 message.txt /*E141* E142 message.txt /*E142* E143 autocmd.txt /*E143* @@ -4502,6 +4496,12 @@ E148 repeat.txt /*E148* E149 helphelp.txt /*E149* E15 eval.txt /*E15* E150 helphelp.txt /*E150* +E1500 builtin.txt /*E1500* +E1501 builtin.txt /*E1501* +E1502 builtin.txt /*E1502* +E1503 builtin.txt /*E1503* +E1504 builtin.txt /*E1504* +E1505 builtin.txt /*E1505* E151 helphelp.txt /*E151* E152 helphelp.txt /*E152* E153 helphelp.txt /*E153* @@ -6496,6 +6496,7 @@ conceal syntax.txt /*conceal* confirm() builtin.txt /*confirm()* connection-refused message.txt /*connection-refused* console-menus gui.txt /*console-menus* +constructor vim9class.txt /*constructor* context.vim ft_context.txt /*context.vim* control intro.txt /*control* conversion-server mbyte.txt /*conversion-server* @@ -6669,6 +6670,7 @@ debugger.txt debugger.txt /*debugger.txt dec-mouse options.txt /*dec-mouse* decada_members ft_ada.txt /*decada_members* deepcopy() builtin.txt /*deepcopy()* +default-constructor vim9class.txt /*default-constructor* defaults.vim starting.txt /*defaults.vim* defaults.vim-explained usr_05.txt /*defaults.vim-explained* define-function userfunc.txt /*define-function* @@ -8920,6 +8922,7 @@ netrw.vim pi_netrw.txt /*netrw.vim* netrw_filehandler pi_netrw.txt /*netrw_filehandler* netterm-mouse options.txt /*netterm-mouse* network pi_netrw.txt /*network* +new() vim9class.txt /*new()* new-5 version5.txt /*new-5* new-6 version6.txt /*new-6* new-7 version7.txt /*new-7* @@ -9311,6 +9314,8 @@ printf-s builtin.txt /*printf-s* printf-x builtin.txt /*printf-x* printing print.txt /*printing* printing-formfeed print.txt /*printing-formfeed* +private-method vim9class.txt /*private-method* +private-variable vim9class.txt /*private-variable* profile repeat.txt /*profile* profiling repeat.txt /*profiling* profiling-variable eval.txt /*profiling-variable* diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt --- a/runtime/doc/vim9class.txt +++ b/runtime/doc/vim9class.txt @@ -150,7 +150,7 @@ If you try to set an object variable tha A object variable cannot be accessed using the class name. Private variables ~ - *E1332* *E1333* + *private-variable* *E1332* *E1333* On the other hand, if you do not want the object variables to be read directly, you can make them private. This is done by prefixing an underscore to the name: > @@ -182,7 +182,7 @@ number to the total number of lines: > enddef < Private methods ~ - *E1366* + *private-method* *E1366* If you want object methods to be accessible only from other methods of the same class and not used from outside the class, then you can make them private. This is done by prefixing the method name with an underscore: > @@ -203,7 +203,7 @@ the above class): > a._Foo() < Simplifying the new() method ~ - + *new()* *constructor* Many constructors take values for the object variables. Thus you very often see this pattern: > @@ -651,7 +651,7 @@ even when the variable name is invalid. Default constructor ~ - + *default-constructor* In case you define a class without a new() method, one will be automatically defined. This default constructor will have arguments for all the object variables, in the order they were specified. Thus if your class looks like: > diff --git a/src/errors.h b/src/errors.h --- a/src/errors.h +++ b/src/errors.h @@ -3532,18 +3532,20 @@ EXTERN char e_missing_name_after_impleme EXTERN char e_cannot_use_an_object_variable_except_with_the_new_method_str[] INIT(= N_("E1390: Cannot use an object variable \"this.%s\" except with the \"new\" method")); #endif +// E1391 - E1499 unused (reserved for Vim9 class support) EXTERN char e_cannot_mix_positional_and_non_positional_str[] - INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s")); + INIT(= N_("E1500: Cannot mix positional and non-positional arguments: %s")); EXTERN char e_fmt_arg_nr_unused_str[] - INIT(= N_("E1401: format argument %d unused in $-style format: %s")); + INIT(= N_("E1501: format argument %d unused in $-style format: %s")); EXTERN char e_positional_num_field_spec_reused_str_str[] - INIT(= N_("E1402: Positional argument %d used as field width reused as different type: %s/%s")); + INIT(= N_("E1502: Positional argument %d used as field width reused as different type: %s/%s")); EXTERN char e_positional_nr_out_of_bounds_str[] - INIT(= N_("E1403: Positional argument %d out of bounds: %s")); + INIT(= N_("E1503: Positional argument %d out of bounds: %s")); EXTERN char e_positional_arg_num_type_inconsistent_str_str[] - INIT(= N_("E1404: Positional argument %d type used inconsistently: %s/%s")); + INIT(= N_("E1504: Positional argument %d type used inconsistently: %s/%s")); EXTERN char e_invalid_format_specifier_str[] - INIT(= N_("E1405: Invalid format specifier: %s")); + INIT(= N_("E1505: Invalid format specifier: %s")); EXTERN char e_aptypes_is_null_nr_str[] - INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s"); -// E1391 - E1399 unused + INIT(= "E1520: Internal error: ap_types or ap_types[idx] is NULL: %d: %s"); + +// E1506 - E1519 unused diff --git a/src/testdir/test_format.vim b/src/testdir/test_format.vim --- a/src/testdir/test_format.vim +++ b/src/testdir/test_format.vim @@ -107,65 +107,65 @@ func Test_printf_pos_misc() call v9.CheckLegacyAndVim9Failure(["call printf('%1$d%2$d', 1, 3, 4)"], "E767:") - call v9.CheckLegacyAndVim9Failure(["call printf('%2$d%d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d%d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$*1$d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%2$.*1$d%d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$.*1$d', 1, 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$%')"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$')"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$_')"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*d', 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*2$d', 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*d', 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%*.*1$d', 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*d', 3)"], "E1400:") - call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*1$d', 3)"], "E1400:") + call v9.CheckLegacyAndVim9Failure(["call printf('%2$d%d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d%d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$*1$d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%2$.*1$d%d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$.*1$d', 1, 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$%')"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$')"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$_')"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*d', 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*2$d', 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*d', 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%*.*1$d', 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*d', 3)"], "E1500:") + call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*1$d', 3)"], "E1500:") - call v9.CheckLegacyAndVim9Failure(["call printf('%2$d', 3, 3)"], "E1401:") + call v9.CheckLegacyAndVim9Failure(["call printf('%2$d', 3, 3)"], "E1501:") - call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d %1$ld', 3, 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$*1$d', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %2$*1$d', 3, 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$ld', 3)"], "E1402:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.*1$ld', 3)"], "E1402:") + call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d %1$ld', 3, 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$*1$d', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %2$*1$d', 3, 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$ld', 3)"], "E1502:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.*1$ld', 3)"], "E1502:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$d%2$d', 3)"], "E1403:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$d%2$d', 3)"], "E1503:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$d %1$s', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$s', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$ud %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$f', 3.0)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$d %1$ld', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$d', 3)"], "E1404:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$d', 3)"], "E1404:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$d %1$s', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$s', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$ud %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$f', 3.0)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$d %1$ld', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$d', 3)"], "E1504:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$d', 3)"], "E1504:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$.2$d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%01$d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%01$0d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3.*2$d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.2$d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*2d', 3)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.5d', 5)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$5.1$d', 5)"], "E1405:") - call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.1$d', 5)"], "E1405:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$.2$d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%01$d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%01$0d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3.*2$d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.2$d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*2d', 3)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.5d', 5)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$5.1$d', 5)"], "E1505:") + call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.1$d', 5)"], "E1505:") endfunc func Test_printf_pos_float() @@ -296,9 +296,9 @@ func Test_printf_pos_errors() call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", [])'], 'E745:') call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", 1, 2)'], 'E767:') call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') - call v9.CheckLegacyAndVim9Failure(['echo printf("%1$s")'], 'E1403:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%1$s")'], 'E1503:') call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", 1.2)'], 'E805:') - call v9.CheckLegacyAndVim9Failure(['echo printf("%1$f")'], 'E1403:') + call v9.CheckLegacyAndVim9Failure(['echo printf("%1$f")'], 'E1503:') endfunc func Test_printf_pos_64bit() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -700,6 +700,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1950, +/**/ 1949, /**/ 1948,