1
0
forked from aniani/vim

patch 8.2.1144: Vim9: return type of reverse() is any

Problem:    Vim9: return type of reverse() is any.
Solution:   Use the type of the first argument.
This commit is contained in:
Bram Moolenaar
2020-07-05 21:10:24 +02:00
parent ad7c249327
commit 67627355ac
3 changed files with 12 additions and 1 deletions

View File

@@ -842,7 +842,7 @@ static funcentry_T global_functions[] =
{"rename", 2, 2, FEARG_1, ret_number, f_rename}, {"rename", 2, 2, FEARG_1, ret_number, f_rename},
{"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat}, {"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat},
{"resolve", 1, 1, FEARG_1, ret_string, f_resolve}, {"resolve", 1, 1, FEARG_1, ret_string, f_resolve},
{"reverse", 1, 1, FEARG_1, ret_any, f_reverse}, {"reverse", 1, 1, FEARG_1, ret_first_arg, f_reverse},
{"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)}, {"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)},
{"rubyeval", 1, 1, FEARG_1, ret_any, {"rubyeval", 1, 1, FEARG_1, ret_any,
#ifdef FEAT_RUBY #ifdef FEAT_RUBY

View File

@@ -927,6 +927,15 @@ def Test_insert_return_type()
assert_equal(6, res) assert_equal(6, res)
enddef enddef
def Test_reverse_return_type()
let l = reverse([1, 2, 3])
let res = 0
for n in l
res += n
endfor
assert_equal(6, res)
enddef
def Test_remove_return_type() def Test_remove_return_type()
let l = remove(#{one: [1, 2], two: [3, 4]}, 'one') let l = remove(#{one: [1, 2], two: [3, 4]}, 'one')
let res = 0 let res = 0

View File

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