Patch 8.2.3166
Problem:    Vim9: nested autoload call error overruled by "Unknown error".
Solution:   Check need_rethrow before giving an "Unknown error".
            (closes #8568)
Files:      src/vim9execute.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.3165/src/vim9execute.c   2021-07-11 17:54:55.576891621 +0200
--- src/vim9execute.c   2021-07-15 17:50:53.473586661 +0200
***************
*** 4737,4743 ****
      // Not sure if this is necessary.
      suppress_errthrow = save_suppress_errthrow;
  
!     if (ret != OK && did_emsg_cumul + did_emsg == did_emsg_before)
        semsg(_(e_unknown_error_while_executing_str),
                                                   printable_func_name(ufunc));
      funcdepth_restore(orig_funcdepth);
--- 4737,4744 ----
      // Not sure if this is necessary.
      suppress_errthrow = save_suppress_errthrow;
  
!     if (ret != OK && did_emsg_cumul + did_emsg == did_emsg_before
!                                                             && !need_rethrow)
        semsg(_(e_unknown_error_while_executing_str),
                                                   printable_func_name(ufunc));
      funcdepth_restore(orig_funcdepth);
*** ../vim-8.2.3165/src/testdir/test_vim9_script.vim    2021-07-11 
20:22:26.260154906 +0200
--- src/testdir/test_vim9_script.vim    2021-07-15 17:50:14.193671204 +0200
***************
*** 3699,3704 ****
--- 3699,3744 ----
    CheckScriptSuccess(lines)
  enddef
  
+ def Test_error_in_autoload_script()
+   var save_rtp = &rtp
+   var dir = getcwd() .. '/Xruntime'
+   &rtp = dir
+   mkdir(dir .. '/autoload', 'p')
+ 
+   var lines =<< trim END
+       vim9script noclear
+       def script#autoloaded()
+       enddef
+       def Broken()
+         var x: any = ''
+         eval x != 0
+       enddef
+       Broken()
+   END
+   writefile(lines, dir .. '/autoload/script.vim')
+ 
+   lines =<< trim END
+       vim9script
+       def CallAutoloaded()
+         script#autoloaded()
+       enddef
+ 
+       function Legacy()
+         try
+           call s:CallAutoloaded()
+         catch
+           call assert_match('E1030: Using a String as a Number', v:exception)
+         endtry
+       endfunction
+ 
+       Legacy()
+   END
+   CheckScriptSuccess(lines)
+ 
+   &rtp = save_rtp
+   delete(dir, 'rf')
+ enddef
+ 
  def Test_cmdline_win()
    # if the Vim syntax highlighting uses Vim9 constructs they can be used from
    # the command line window.
*** ../vim-8.2.3165/src/version.c       2021-07-15 15:40:54.738804508 +0200
--- src/version.c       2021-07-15 17:50:11.549676938 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3166,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
152. You find yourself falling for someone you've never seen or hardly
     know, but, boy can he/she TYPE!!!!!!

 /// 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/202107151610.16FGAQge1925558%40masaka.moolenaar.net.

Raspunde prin e-mail lui