Problem: Vim9: no check for whitespace after comma in lambda.
Solution: Give error if white space is missing.
enddef
def Test_expr7_lambda()
- " lambda
let La = { -> 'result'}
assert_equal('result', La())
assert_equal([1, 3, 5], [1, 2, 3]->map({key, val -> key + val}))
+
+ call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
enddef
def Test_expr7_lambda_vim9script()
def Line_continuation_in_lambda(): list<number>
let x = range(97, 100)
- ->map({_,v -> nr2char(v)
+ ->map({_, v -> nr2char(v)
->toupper()})
->reverse()
return x
else if (any_default)
{
emsg(_("E989: Non-default argument follows default argument"));
- mustend = TRUE;
+ goto err_ret;
}
if (*p == ',')
+ {
++p;
+ // Don't give this error when skipping, it makes the "->" not
+ // found in "{k,v -> x}" and give a confusing error.
+ if (!skip && in_vim9script()
+ && !IS_WHITE_OR_NUL(*p) && *p != endchar)
+ {
+ semsg(_(e_white_after), ",");
+ goto err_ret;
+ }
+ }
else
mustend = TRUE;
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1182,
/**/
1181,
/**/