To: vim_dev@googlegroups.com Subject: Patch 9.0.0992 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0992 Problem: Vim9 script: get E1096 when comment follows return. Solution: Adjust condition for return without expression. (closes #11654) Files: src/vim9cmds.c, src/testdir/test_vim9_func.vim *** ../vim-9.0.0991/src/vim9cmds.c 2022-11-02 13:30:37.542314565 +0000 --- src/vim9cmds.c 2022-12-02 18:10:38.094547622 +0000 *************** *** 2531,2537 **** char_u *p = arg; type_T *stack_type; ! if (*p != NUL && *p != '|' && *p != '\n') { // For a lambda, "return expr" is always used, also when "expr" results // in a void. --- 2531,2538 ---- char_u *p = arg; type_T *stack_type; ! if (*p != NUL && *p != '|' && *p != '\n' ! && (legacy || !vim9_comment_start(p))) { // For a lambda, "return expr" is always used, also when "expr" results // in a void. *** ../vim-9.0.0991/src/testdir/test_vim9_func.vim 2022-10-13 16:12:51.748207004 +0100 --- src/testdir/test_vim9_func.vim 2022-12-02 18:04:40.314833446 +0000 *************** *** 467,472 **** --- 467,483 ---- v9.CheckScriptSuccess(lines) enddef + def Test_return_void_comment_follows() + var lines =<< trim END + vim9script + def ReturnCommentFollows(): void + return # Some comment + enddef + defcompile + END + v9.CheckScriptSuccess(lines) + enddef + let s:nothing = 0 def ReturnNothing() s:nothing = 1 *** ../vim-9.0.0991/src/version.c 2022-12-02 16:39:40.959082305 +0000 --- src/version.c 2022-12-02 18:07:26.506705388 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 992, /**/ -- Your mouse has moved. Windows must be restarted for the change to take effect. Reboot now? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///