Patch 8.2.4146
Problem:    Vim9: shadowed function can be used in compiled function but not
            at script level.
Solution:   Also give an error in a compiled function. (closes #9563)
Files:      src/vim9expr.c


*** ../vim-8.2.4145/src/vim9expr.c      2022-01-18 17:43:01.061598437 +0000
--- src/vim9expr.c      2022-01-19 17:11:31.586187277 +0000
***************
*** 668,673 ****
--- 668,688 ----
      int               res = FAIL;
      int               is_autoload;
      int               is_searchpair;
+     imported_T        *import;
+ 
+     if (varlen >= sizeof(namebuf))
+     {
+       semsg(_(e_name_too_long_str), name);
+       return FAIL;
+     }
+     vim_strncpy(namebuf, *arg, varlen);
+ 
+     import = find_imported(name, varlen, FALSE, cctx);
+     if (import != NULL)
+     {
+       semsg(_(e_cannot_use_str_itself_it_is_imported), namebuf);
+       return FAIL;
+     }
  
      // We can evaluate "has('name')" at compile time.
      // We always evaluate "exists_compiled()" at compile time.
***************
*** 713,724 ****
      if (generate_ppconst(cctx, ppconst) == FAIL)
        return FAIL;
  
-     if (varlen >= sizeof(namebuf))
-     {
-       semsg(_(e_name_too_long_str), name);
-       return FAIL;
-     }
-     vim_strncpy(namebuf, *arg, varlen);
      name = fname_trans_sid(namebuf, fname_buf, &tofree, &error);
  
      // We handle the "skip" argument of searchpair() and searchpairpos()
--- 728,733 ----
*** ../vim-8.2.4145/src/version.c       2022-01-19 17:21:24.850755237 +0000
--- src/version.c       2022-01-19 17:22:22.017652261 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4146,
  /**/

-- 
If your life is a hard drive,
Christ can be your backup.

 /// 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/20220119172332.9FBF91C0243%40moolenaar.net.

Raspunde prin e-mail lui