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

patch 8.2.1138: Vim9: return type of copy() and deepcopy() is any

Problem:    Vim9: return type of copy() and deepcopy() is any.
Solution:   Use type of the argument.
This commit is contained in:
Bram Moolenaar 2020-07-05 18:41:08 +02:00
parent 47e7d70b58
commit a66ba01a5f
3 changed files with 20 additions and 2 deletions

View File

@ -544,7 +544,7 @@ static funcentry_T global_functions[] =
{"complete_check", 0, 0, 0, ret_number, f_complete_check}, {"complete_check", 0, 0, 0, ret_number, f_complete_check},
{"complete_info", 0, 1, FEARG_1, ret_dict_any, f_complete_info}, {"complete_info", 0, 1, FEARG_1, ret_dict_any, f_complete_info},
{"confirm", 1, 4, FEARG_1, ret_number, f_confirm}, {"confirm", 1, 4, FEARG_1, ret_number, f_confirm},
{"copy", 1, 1, FEARG_1, ret_any, f_copy}, {"copy", 1, 1, FEARG_1, ret_first_arg, f_copy},
{"cos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cos)}, {"cos", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cos)},
{"cosh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cosh)}, {"cosh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_cosh)},
{"count", 2, 4, FEARG_1, ret_number, f_count}, {"count", 2, 4, FEARG_1, ret_number, f_count},
@ -557,7 +557,7 @@ static funcentry_T global_functions[] =
NULL NULL
#endif #endif
}, },
{"deepcopy", 1, 2, FEARG_1, ret_any, f_deepcopy}, {"deepcopy", 1, 2, FEARG_1, ret_first_arg, f_deepcopy},
{"delete", 1, 2, FEARG_1, ret_number, f_delete}, {"delete", 1, 2, FEARG_1, ret_number, f_delete},
{"deletebufline", 2, 3, FEARG_1, ret_number, f_deletebufline}, {"deletebufline", 2, 3, FEARG_1, ret_number, f_deletebufline},
{"did_filetype", 0, 0, 0, ret_number, f_did_filetype}, {"did_filetype", 0, 0, 0, ret_number, f_did_filetype},

View File

@ -893,6 +893,22 @@ def Test_getloclist_return_type()
assert_equal(#{items: []}, d) assert_equal(#{items: []}, d)
enddef enddef
def Test_copy_return_type()
let l = copy([1, 2, 3])
let res = 0
for n in l
res += n
endfor
assert_equal(6, res)
let dl = deepcopy([1, 2, 3])
res = 0
for n in dl
res += n
endfor
assert_equal(6, res)
enddef
def Line_continuation_in_def(dir: string = ''): string def Line_continuation_in_def(dir: string = ''): string
let path: string = empty(dir) let path: string = empty(dir)
\ ? 'empty' \ ? 'empty'

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 */
/**/
1138,
/**/ /**/
1137, 1137,
/**/ /**/