0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.1142: Vim9: return type of insert() is any

Problem:    Vim9: return type of insert() is any.
Solution:   Use type of the first argument.
This commit is contained in:
Bram Moolenaar 2020-07-05 20:47:18 +02:00
parent 0d94ad6958
commit 252e88a785
3 changed files with 12 additions and 1 deletions

View File

@ -667,7 +667,7 @@ static funcentry_T global_functions[] =
{"inputrestore", 0, 0, 0, ret_number, f_inputrestore},
{"inputsave", 0, 0, 0, ret_number, f_inputsave},
{"inputsecret", 1, 2, FEARG_1, ret_string, f_inputsecret},
{"insert", 2, 3, FEARG_1, ret_any, f_insert},
{"insert", 2, 3, FEARG_1, ret_first_arg, f_insert},
{"interrupt", 0, 0, 0, ret_void, f_interrupt},
{"invert", 1, 1, FEARG_1, ret_number, f_invert},
{"isdirectory", 1, 1, FEARG_1, ret_number, f_isdirectory},

View File

@ -918,6 +918,15 @@ def Test_extend_return_type()
assert_equal(6, res)
enddef
def Test_insert_return_type()
let l = insert([2, 1], 3)
let res = 0
for n in l
res += n
endfor
assert_equal(6, res)
enddef
def Test_filter_return_type()
let l = filter([1, 2, 3], {-> 1})
let res = 0

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1142,
/**/
1141,
/**/