1
0
forked from aniani/vim

patch 8.2.1132: Vim9: return type of repeat() is not specific enough

Problem:    Vim9: return type of repeat() is not specific enough.
Solution:   Return the type of the first argument. (closes #6395)
This commit is contained in:
Bram Moolenaar
2020-07-05 16:01:56 +02:00
parent 05a5551a86
commit 9978d473e3
3 changed files with 12 additions and 2 deletions

View File

@@ -815,10 +815,10 @@ static funcentry_T global_functions[] =
{"remote_peek", 1, 2, FEARG_1, ret_number, f_remote_peek},
{"remote_read", 1, 2, FEARG_1, ret_string, f_remote_read},
{"remote_send", 2, 3, FEARG_1, ret_string, f_remote_send},
{"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver},
{"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver},
{"remove", 2, 3, FEARG_1, ret_any, f_remove},
{"rename", 2, 2, FEARG_1, ret_number, f_rename},
{"repeat", 2, 2, FEARG_1, ret_any, f_repeat},
{"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat},
{"resolve", 1, 1, FEARG_1, ret_string, f_resolve},
{"reverse", 1, 1, FEARG_1, ret_any, f_reverse},
{"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)},

View File

@@ -596,6 +596,14 @@ def Test_func_type()
assert_equal(13, funcResult)
enddef
def Test_repeat_return_type()
let res = 0
for n in repeat([1], 3)
res += n
endfor
assert_equal(3, res)
enddef
def Test_func_type_part()
let RefVoid: func: void
RefVoid = FuncNoArgNoRet

View File

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