mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2726: confusing error message with white space before comma
Problem: Confusing error message with white space before comma in the arguments of a function declaration. Solution: Give a specific error message. (closes #2235)
This commit is contained in:
@@ -1263,6 +1263,15 @@ def Test_arg_type_wrong()
|
|||||||
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
|
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_white_space_before_comma()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Func(a: number , b: number)
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1068:')
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_white_space_after_comma()
|
def Test_white_space_after_comma()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@@ -307,6 +307,17 @@ get_function_args(
|
|||||||
emsg(_("E989: Non-default argument follows default argument"));
|
emsg(_("E989: Non-default argument follows default argument"));
|
||||||
goto err_ret;
|
goto err_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VIM_ISWHITE(*p) && *skipwhite(p) == ',')
|
||||||
|
{
|
||||||
|
// Be tolerant when skipping
|
||||||
|
if (!skip)
|
||||||
|
{
|
||||||
|
semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
|
||||||
|
goto err_ret;
|
||||||
|
}
|
||||||
|
p = skipwhite(p);
|
||||||
|
}
|
||||||
if (*p == ',')
|
if (*p == ',')
|
||||||
{
|
{
|
||||||
++p;
|
++p;
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2726,
|
||||||
/**/
|
/**/
|
||||||
2725,
|
2725,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user