1
0
forked from aniani/vim

patch 8.2.2053: Vim9: lamba doesn't accept argument types

Problem:    Vim9: lamba doesn't accept argument types.
Solution:   Optionally accept argument types at the script level.
This commit is contained in:
Bram Moolenaar 2020-11-25 21:30:11 +01:00
parent 47a2abf0bc
commit c2ca935d26
3 changed files with 6 additions and 1 deletions

View File

@ -3266,7 +3266,7 @@ eval7(
* Lambda: {arg, arg -> expr}
* Dictionary: {'key': val, 'key': val}
*/
case '{': ret = get_lambda_tv(arg, rettv, FALSE, evalarg);
case '{': ret = get_lambda_tv(arg, rettv, in_vim9script(), evalarg);
if (ret == NOTDONE)
ret = eval_dict(arg, rettv, evalarg, FALSE);
break;

View File

@ -1828,6 +1828,9 @@ def Test_expr7_lambda()
assert_equal(false, LambdaUsingArg(0)())
assert_equal(true, LambdaUsingArg(1)())
var res = map([1, 2, 3], {i: number, v: number -> i + v})
assert_equal([1, 3, 5], res)
END
CheckDefAndScriptSuccess(lines)

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2053,
/**/
2052,
/**/