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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221202181230.C55661C5967%40moolenaar.net.

Raspunde prin e-mail lui