Patch 8.2.4927
Problem:    Return type of remove() incorrect when using three arguments.
Solution:   Use first argument type when there are three arguments.
            (closes #10387)
Files:      src/evalfunc.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.4926/src/evalfunc.c      2022-05-07 21:14:01.642973330 +0100
--- src/evalfunc.c      2022-05-09 14:04:59.872704981 +0100
***************
*** 1420,1432 ****
      static type_T *
  ret_remove(int argcount,
        type2_T *argtypes,
!       type_T  **decl_type UNUSED)
  {
      if (argcount > 0)
      {
        if (argtypes[0].type_curr->tt_type == VAR_LIST
                || argtypes[0].type_curr->tt_type == VAR_DICT)
        {
            if (argtypes[0].type_curr->tt_type
                                             == argtypes[0].type_decl->tt_type)
                *decl_type = argtypes[0].type_decl->tt_member;
--- 1420,1437 ----
      static type_T *
  ret_remove(int argcount,
        type2_T *argtypes,
!       type_T  **decl_type)
  {
      if (argcount > 0)
      {
        if (argtypes[0].type_curr->tt_type == VAR_LIST
                || argtypes[0].type_curr->tt_type == VAR_DICT)
        {
+           if (argcount == 3)
+           {
+               *decl_type = argtypes[0].type_decl;
+               return argtypes[0].type_curr;
+           }
            if (argtypes[0].type_curr->tt_type
                                             == argtypes[0].type_decl->tt_type)
                *decl_type = argtypes[0].type_decl->tt_member;
*** ../vim-8.2.4926/src/testdir/test_vim9_builtin.vim   2022-05-06 
17:53:02.685329543 +0100
--- src/testdir/test_vim9_builtin.vim   2022-05-09 14:11:17.888425121 +0100
***************
*** 3208,3219 ****
  enddef
  
  def Test_remove_return_type()
!   var l = remove({one: [1, 2], two: [3, 4]}, 'one')
!   var res = 0
!   for n in l
!     res += n
!   endfor
!   res->assert_equal(3)
  enddef
  
  def Test_rename()
--- 3208,3218 ----
  enddef
  
  def Test_remove_return_type()
!   var l: list<number> = remove({one: [1, 2], two: [3, 4]}, 'one')
!   l->assert_equal([1, 2])
! 
!   var ll: list<number> = remove(range(3), 0, 1)
!   ll->assert_equal([0, 1])
  enddef
  
  def Test_rename()
*** ../vim-8.2.4926/src/version.c       2022-05-09 13:33:36.054167847 +0100
--- src/version.c       2022-05-09 14:06:22.408643002 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4927,
  /**/

-- 
You are not really successful until someone claims he sat
beside you in school.

 /// 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/20220509131247.080EA1C0761%40moolenaar.net.

Raspunde prin e-mail lui