patch 9.0.1950: Vim9: error codes spread out Commit: https://github.com/vim/vim/commit/413f83990f15d5d59d27ab741670f527a7a3feb8 Author: Yegappan Lakshmanan <yegap...@yahoo.com> 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 <c...@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegap...@yahoo.com> diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 74e024d97..8a92ff6ec 100644 --- 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 index 13baf8fd1..266b4297b 100644 --- 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 index 7b9f8b4a6..5cbdc72e1 100644 --- a/runtime/doc/vim9class.txt +++ b/runtime/doc/vim9class.txt @@ -150,7 +150,7 @@ If you try to set an object variable that doesn't exist you get an error: > 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. *E1360* *E1362* *E1363* 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 index baf36d5e4..975e033b5 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3532,18 +3532,20 @@ EXTERN char e_missing_name_after_implements[] 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 index f665d15a9..af364c2a1 100644 --- 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', 3, 3)"], "E1401:") - - 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('%1$d%2$d', 3)"], "E1403:") - - 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$.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('%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)"], "E1501:") + + 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)"], "E1503:") + + 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)"], "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 index dade6d2fe..0bb2239ee 100644 --- a/src/version.c +++ b/src/version.c @@ -699,6 +699,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1950, /**/ 1949, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1qly79-00G8xs-La%40256bit.org.