changeset 21178:fab2085e417f v8.2.1140

patch 8.2.1140: Vim9: return type of extend() is any Commit: https://github.com/vim/vim/commit/b3c019cbc32e2e9250ac668bf77d61ebd89c13f2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 5 20:08:39 2020 +0200 patch 8.2.1140: Vim9: return type of extend() is any Problem: Vim9: return type of extend() is any. Solution: Use type of the argument.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jul 2020 20:15:03 +0200
parents 3bc0c7d4e286
children 2bf0ee9ae1c7
files src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -576,7 +576,7 @@ static funcentry_T global_functions[] =
     {"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},
+    {"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},
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -909,6 +909,15 @@ def Test_copy_return_type()
   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'
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1140,
+/**/
     1139,
 /**/
     1138,