forked from aniani/vim
patch 8.2.1141: Vim9: return type of filter() is any
Problem: Vim9: return type of filter() is any. Solution: Use type of the argument.
This commit is contained in:
@@ -581,7 +581,7 @@ static funcentry_T global_functions[] =
|
||||
{"file_readable", 1, 1, FEARG_1, ret_number, f_filereadable}, // obsolete
|
||||
{"filereadable", 1, 1, FEARG_1, ret_number, f_filereadable},
|
||||
{"filewritable", 1, 1, FEARG_1, ret_number, f_filewritable},
|
||||
{"filter", 2, 2, FEARG_1, ret_any, f_filter},
|
||||
{"filter", 2, 2, FEARG_1, ret_first_arg, f_filter},
|
||||
{"finddir", 1, 3, FEARG_1, ret_string, f_finddir},
|
||||
{"findfile", 1, 3, FEARG_1, ret_string, f_findfile},
|
||||
{"flatten", 1, 2, FEARG_1, ret_list_any, f_flatten},
|
||||
|
@@ -918,6 +918,15 @@ def Test_extend_return_type()
|
||||
assert_equal(6, res)
|
||||
enddef
|
||||
|
||||
def Test_filter_return_type()
|
||||
let l = filter([1, 2, 3], {-> 1})
|
||||
let res = 0
|
||||
for n in l
|
||||
res += n
|
||||
endfor
|
||||
assert_equal(6, res)
|
||||
enddef
|
||||
|
||||
def Line_continuation_in_def(dir: string = ''): string
|
||||
let path: string = empty(dir)
|
||||
\ ? 'empty'
|
||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1141,
|
||||
/**/
|
||||
1140,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user