# HG changeset patch # User Bram Moolenaar # Date 1606337104 -3600 # Node ID a0a998d2e443648f87f9c97146d78222cc24ef17 # Parent 11abae1d1ce926ed9046202cba4c14cb613496b9 patch 8.2.2053: Vim9: lamba doesn't accept argument types Commit: https://github.com/vim/vim/commit/c2ca935d26b3fc64a13d4e7d0583fc787efe61d0 Author: Bram Moolenaar Date: Wed Nov 25 21:30:11 2020 +0100 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. diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -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; diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -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) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2053, +/**/ 2052, /**/ 2051,