Patch 8.2.3058 (after 8.2.3056)
Problem: Vim9: cannot use ternary operator in parenthesis.
Solution: Do not use "==" for a default argument value. (closes #8462)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.3057/src/userfunc.c 2021-06-26 19:25:42.744311276 +0200
--- src/userfunc.c 2021-06-26 21:47:35.934484091 +0200
***************
*** 266,278 ****
}
else
{
arg = p;
p = one_function_arg(p, newargs, argtypes, types_optional,
evalarg, FALSE, skip);
if (p == arg)
break;
! if (*skipwhite(p) == '=' && default_args != NULL)
{
typval_T rettv;
--- 266,283 ----
}
else
{
+ char_u *np;
+
arg = p;
p = one_function_arg(p, newargs, argtypes, types_optional,
evalarg, FALSE, skip);
if (p == arg)
break;
! // Recognize " = expr" but not " == expr". A lambda can have
! // "(a = expr" but "(a == expr" is not a lambda.
! np = skipwhite(p);
! if (*np == '=' && np[1] != '=' && default_args != NULL)
{
typval_T rettv;
*** ../vim-8.2.3057/src/testdir/test_vim9_func.vim 2021-06-26
19:25:42.744311276 +0200
--- src/testdir/test_vim9_func.vim 2021-06-26 21:49:14.742394823 +0200
***************
*** 924,929 ****
--- 924,936 ----
CheckDefAndScriptFailure(lines, 'E1172:')
lines =<< trim END
+ var a = 0
+ var b = (a == 0 ? 1 : 2)
+ assert_equal(1, b)
+ END
+ CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
def ShadowLocal()
var one = 1
var l = [1, 2, 3]
*** ../vim-8.2.3057/src/version.c 2021-06-26 21:20:59.791632565 +0200
--- src/version.c 2021-06-26 21:51:43.602238681 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3058,
/**/
--
Change is inevitable, except from a vending machine.
/// 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/202106262001.15QK1EEF434457%40masaka.moolenaar.net.