Patch 8.2.3056
Problem: Vim9: using default value in lambda gives confusing error.
Solution: Pass "default_args" on the first pass to get the arguments.
(closes #8455)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.3055/src/userfunc.c 2021-06-21 20:48:54.968049445 +0200
--- src/userfunc.c 2021-06-26 19:12:16.945728987 +0200
***************
*** 1222,1228 ****
s = *arg + 1;
ret = get_function_args(&s, equal_arrow ? ')' : '-', NULL,
types_optional ? &argtypes : NULL, types_optional, evalarg,
! NULL, NULL, TRUE, NULL, NULL);
if (ret == FAIL || skip_arrow(s, equal_arrow, &ret_type, NULL) == NULL)
{
if (types_optional)
--- 1222,1228 ----
s = *arg + 1;
ret = get_function_args(&s, equal_arrow ? ')' : '-', NULL,
types_optional ? &argtypes : NULL, types_optional, evalarg,
! NULL, &default_args, TRUE, NULL, NULL);
if (ret == FAIL || skip_arrow(s, equal_arrow, &ret_type, NULL) == NULL)
{
if (types_optional)
*** ../vim-8.2.3055/src/testdir/test_vim9_func.vim 2021-06-26
13:00:45.734565919 +0200
--- src/testdir/test_vim9_func.vim 2021-06-26 19:24:40.460420955 +0200
***************
*** 918,923 ****
--- 918,929 ----
CheckScriptFailure(['vim9script'] + lines, 'E1168:')
lines =<< trim END
+ var Ref: func(any, ?any): bool
+ Ref = (_, y = 1) => false
+ END
+ CheckDefAndScriptFailure(lines, 'E1172:')
+
+ lines =<< trim END
def ShadowLocal()
var one = 1
var l = [1, 2, 3]
*** ../vim-8.2.3055/src/version.c 2021-06-26 15:00:55.881276189 +0200
--- src/version.c 2021-06-26 19:14:20.489511838 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3056,
/**/
--
A day without sunshine is like, well, night.
/// 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/202106261726.15QHQKPJ385977%40masaka.moolenaar.net.