To: vim_dev@googlegroups.com Subject: Patch 8.2.2576 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2576 Problem: Vim9: defining a :func function checks for white space after a comma in the arguments. Solution: Only check for white space in a :def function. (closes #7930) Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.2575/src/userfunc.c 2021-02-28 16:55:07.513026844 +0100 --- src/userfunc.c 2021-03-06 22:33:04.309940216 +0100 *************** *** 310,316 **** ++p; // Don't give this error when skipping, it makes the "->" not // found in "{k,v -> x}" and give a confusing error. ! if (!skip && in_vim9script() && !IS_WHITE_OR_NUL(*p) && *p != endchar) { semsg(_(e_white_space_required_after_str_str), ",", p - 1); --- 310,317 ---- ++p; // Don't give this error when skipping, it makes the "->" not // found in "{k,v -> x}" and give a confusing error. ! // Allow missing space after comma in legacy functions. ! if (!skip && argtypes != NULL && !IS_WHITE_OR_NUL(*p) && *p != endchar) { semsg(_(e_white_space_required_after_str_str), ",", p - 1); *** ../vim-8.2.2575/src/testdir/test_vim9_func.vim 2021-03-06 19:26:42.431369337 +0100 --- src/testdir/test_vim9_func.vim 2021-03-06 22:31:27.410177035 +0100 *************** *** 1136,1141 **** --- 1136,1158 ---- CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:') enddef + def Test_white_space_after_comma() + var lines =<< trim END + vim9script + def Func(a: number,b: number) + enddef + END + CheckScriptFailure(lines, 'E1069:') + + # OK in legacy function + lines =<< trim END + vim9script + func Func(a,b) + endfunc + END + CheckScriptSuccess(lines) + enddef + def Test_vim9script_call() var lines =<< trim END vim9script *** ../vim-8.2.2575/src/version.c 2021-03-06 21:01:05.865089577 +0100 --- src/version.c 2021-03-06 22:26:03.954947572 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2576, /**/ -- We apologise again for the fault in the subtitles. Those responsible for sacking the people who have just been sacked have been sacked. "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 ///