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

patch 8.2.1133: Vim9: return type of add() is not specific enough

Problem:    Vim9: return type of add() 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:07:21 +02:00
parent 9978d473e3
commit fce82b3aa7
3 changed files with 9 additions and 1 deletions

View File

@ -441,7 +441,7 @@ static funcentry_T global_functions[] =
{
{"abs", 1, 1, FEARG_1, ret_any, FLOAT_FUNC(f_abs)},
{"acos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_acos)},
{"add", 2, 2, FEARG_1, ret_any, f_add},
{"add", 2, 2, FEARG_1, ret_first_arg, f_add},
{"and", 2, 2, FEARG_1, ret_number, f_and},
{"append", 2, 2, FEARG_LAST, ret_number, f_append},
{"appendbufline", 3, 3, FEARG_LAST, ret_number, f_appendbufline},

View File

@ -602,6 +602,12 @@ def Test_repeat_return_type()
res += n
endfor
assert_equal(3, res)
res = 0
for n in add([1, 2], 3)
res += n
endfor
assert_equal(6, res)
enddef
def Test_func_type_part()

View File

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