Patch 8.2.1140
Problem:    Vim9: return type of extend() is any.
Solution:   Use type of the argument.
Files:      src/evalfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1139/src/evalfunc.c      2020-07-05 18:41:05.171877168 +0200
--- src/evalfunc.c      2020-07-05 20:05:09.328499802 +0200
***************
*** 576,582 ****
      {"exp",           1, 1, FEARG_1,    ret_float,    FLOAT_FUNC(f_exp)},
      {"expand",                1, 3, FEARG_1,    ret_any,      f_expand},
      {"expandcmd",     1, 1, FEARG_1,    ret_string,   f_expandcmd},
!     {"extend",                2, 3, FEARG_1,    ret_any,      f_extend},
      {"feedkeys",      1, 2, FEARG_1,    ret_void,     f_feedkeys},
      {"file_readable", 1, 1, FEARG_1,    ret_number,   f_filereadable}, // 
obsolete
      {"filereadable",  1, 1, FEARG_1,    ret_number,   f_filereadable},
--- 576,582 ----
      {"exp",           1, 1, FEARG_1,    ret_float,    FLOAT_FUNC(f_exp)},
      {"expand",                1, 3, FEARG_1,    ret_any,      f_expand},
      {"expandcmd",     1, 1, FEARG_1,    ret_string,   f_expandcmd},
!     {"extend",                2, 3, FEARG_1,    ret_first_arg, f_extend},
      {"feedkeys",      1, 2, FEARG_1,    ret_void,     f_feedkeys},
      {"file_readable", 1, 1, FEARG_1,    ret_number,   f_filereadable}, // 
obsolete
      {"filereadable",  1, 1, FEARG_1,    ret_number,   f_filereadable},
*** ../vim-8.2.1139/src/testdir/test_vim9_func.vim      2020-07-05 
18:48:19.973854268 +0200
--- src/testdir/test_vim9_func.vim      2020-07-05 20:06:33.656265838 +0200
***************
*** 909,914 ****
--- 909,923 ----
    assert_equal(6, res)
  enddef
  
+ def Test_extend_return_type()
+   let l = extend([1, 2], [3])
+   let res = 0
+   for n in l
+     res += n
+   endfor
+   assert_equal(6, res)
+ enddef
+ 
  def Line_continuation_in_def(dir: string = ''): string
      let path: string = empty(dir)
              \ ? 'empty'
*** ../vim-8.2.1139/src/version.c       2020-07-05 18:48:19.973854268 +0200
--- src/version.c       2020-07-05 20:05:47.272395422 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1140,
  /**/

-- 
Lower life forms have more fun!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202007051809.065I94E8634382%40masaka.moolenaar.net.

Raspunde prin e-mail lui