To: vim_dev@googlegroups.com Subject: Patch 8.2.2544 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2544 Problem: Vim9: error for argument when checking for lambda. Solution: Respect the skip flag. (closes #7887) Files: src/userfunc.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.2543/src/userfunc.c 2021-02-21 22:20:18.861587677 +0100 --- src/userfunc.c 2021-02-23 12:04:36.670902855 +0100 *************** *** 82,88 **** } // Vim9 script: cannot use script var name for argument. ! if (argtypes != NULL && script_var_exists(arg, p - arg, FALSE, NULL) == OK) { semsg(_(e_variable_already_declared_in_script), arg); return arg; --- 82,89 ---- } // Vim9 script: cannot use script var name for argument. ! if (!skip && argtypes != NULL && script_var_exists(arg, p - arg, ! FALSE, NULL) == OK) { semsg(_(e_variable_already_declared_in_script), arg); return arg; *** ../vim-8.2.2543/src/testdir/test_vim9_expr.vim 2021-02-03 17:41:19.924245848 +0100 --- src/testdir/test_vim9_expr.vim 2021-02-23 12:03:50.323101754 +0100 *************** *** 1922,1927 **** --- 1922,1935 ---- CheckDefSuccess(['var Fx = (a) => [0,', ' 1]']) CheckDefFailure(['var Fx = (a) => [0', ' 1]'], 'E696:', 2) + + # no error for existing script variable when checking for lambda + lines =<< trim END + vim9script + var name = 0 + eval (name + 2) / 3 + END + CheckScriptSuccess(lines) enddef def NewLambdaWithComments(): func *** ../vim-8.2.2543/src/version.c 2021-02-22 22:45:02.183661677 +0100 --- src/version.c 2021-02-23 12:01:09.339796328 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2544, /**/ -- MONK: ... and the Lord spake, saying, "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shalt be the number thou shalt count, and the number of the counting shalt be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thou foe, who being naughty in my sight, shall snuff it. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///