1
0
forked from aniani/vim

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 <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
Yegappan Lakshmanan
2023-09-28 22:46:37 +02:00
committed by Christian Brabandt
parent f057aca1cc
commit 413f83990f
6 changed files with 96 additions and 87 deletions

View File

@@ -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()*

View File

@@ -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*

View File

@@ -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: >