Patch 8.2.2481

4 views
Skip to first unread message

Bram Moolenaar

unread,
Feb 7, 2021, 10:00:48 AM2/7/21
to vim...@googlegroups.com

Patch 8.2.2481
Problem: Vim9: confusing error when variable arguments have a default
value.
Solution: Give a specific error message. (closes #7793)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2480/src/userfunc.c 2021-02-07 15:28:05.792508596 +0100
--- src/userfunc.c 2021-02-07 15:52:48.255900979 +0100
***************
*** 241,246 ****
--- 241,251 ----
skip);
if (p == arg)
break;
+ if (*skipwhite(p) == '=')
+ {
+ emsg(_(e_cannot_use_default_for_variable_arguments));
+ break;
+ }
}
}
else
*** ../vim-8.2.2480/src/testdir/test_vim9_func.vim 2021-01-31 22:18:21.977811108 +0100
--- src/testdir/test_vim9_func.vim 2021-02-07 15:56:58.151121020 +0100
***************
*** 781,786 ****
--- 781,796 ----
Func(1, 'a')
END
CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch')
+
+ lines =<< trim END
+ vim9script
+ def Func( # some comment
+ ...l = []
+ )
+ echo l
+ enddef
+ END
+ CheckScriptFailure(lines, 'E1160:')
enddef

let s:value = ''
*** ../vim-8.2.2480/src/version.c 2021-02-07 15:28:05.792508596 +0100
--- src/version.c 2021-02-07 15:57:35.447004907 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2481,
/**/

--
Futility Factor: No experiment is ever a complete failure - it can always
serve as a negative example.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages