From: Bram Moolenaar Date: Wed, 25 Nov 2020 20:30:11 +0000 (+0100) Subject: patch 8.2.2053: Vim9: lamba doesn't accept argument types X-Git-Tag: v8.2.2053 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2ca935d26b3fc64a13d4e7d0583fc787efe61d0;p=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. --- diff --git a/src/eval.c b/src/eval.c index 6fea43605..f23d721df 100644 --- 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 index 02f8c0ad0..57307a27e 100644 --- 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 index c653cdc84..bd8abac7a 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2053, /**/ 2052, /**/