To: vim_dev@googlegroups.com Subject: Patch 8.2.2053 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2053 Problem: Vim9: lamba doesn't accept argument types. Solution: Optionally accept argument types at the script level. Files: src/eval.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.2052/src/eval.c 2020-11-23 08:31:14.101789113 +0100 --- src/eval.c 2020-11-25 21:26:24.239055411 +0100 *************** *** 3266,3272 **** * Lambda: {arg, arg -> expr} * Dictionary: {'key': val, 'key': val} */ ! case '{': ret = get_lambda_tv(arg, rettv, FALSE, evalarg); if (ret == NOTDONE) ret = eval_dict(arg, rettv, evalarg, FALSE); break; --- 3266,3272 ---- * Lambda: {arg, arg -> expr} * Dictionary: {'key': val, 'key': val} */ ! case '{': ret = get_lambda_tv(arg, rettv, in_vim9script(), evalarg); if (ret == NOTDONE) ret = eval_dict(arg, rettv, evalarg, FALSE); break; *** ../vim-8.2.2052/src/testdir/test_vim9_expr.vim 2020-11-19 18:53:15.188492574 +0100 --- src/testdir/test_vim9_expr.vim 2020-11-25 21:06:36.592764161 +0100 *************** *** 1828,1833 **** --- 1828,1836 ---- 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) *** ../vim-8.2.2052/src/version.c 2020-11-25 20:09:05.517445569 +0100 --- src/version.c 2020-11-25 21:27:30.370771696 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2053, /**/ -- ARTHUR: Will you ask your master if he wants to join my court at Camelot?! GUARD #1: But then of course African swallows are not migratory. GUARD #2: Oh, yeah... GUARD #1: So they couldn't bring a coconut back anyway... The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///