Patch 8.2.2726
Problem: Confusing error message with white space before comma in the
arguments of a function declaration.
Solution: Give a specific error message. (closes #2235)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.2725/src/userfunc.c 2021-03-29 22:14:45.604788424 +0200
--- src/userfunc.c 2021-04-06 18:55:34.083812630 +0200
***************
*** 307,312 ****
--- 307,323 ----
emsg(_("E989: Non-default argument follows default argument"));
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 == ',')
{
++p;
*** ../vim-8.2.2725/src/testdir/test_vim9_func.vim 2021-04-05
22:27:33.402532604 +0200
--- src/testdir/test_vim9_func.vim 2021-04-06 19:00:35.835073668 +0200
***************
*** 1263,1268 ****
--- 1263,1277 ----
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
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()
var lines =<< trim END
vim9script
*** ../vim-8.2.2725/src/version.c 2021-04-05 22:27:33.402532604 +0200
--- src/version.c 2021-04-06 18:57:03.499593895 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2726,
/**/
--
hundred-and-one symptoms of being an internet addict:
74. Your most erotic dreams are about cybersex
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202104061702.136H2CRB3384118%40masaka.moolenaar.net.