mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
patch 8.2.1003: Vim9: return type of sort() is too generic
Problem: Vim9: return type of sort() is too generic. Solution: Get type from the first argument. (closes #6292)
This commit is contained in:
parent
ceb2e77510
commit
865af6b990
@ -339,6 +339,14 @@ ret_job(int argcount UNUSED, type_T **argtypes UNUSED)
|
|||||||
return &t_job;
|
return &t_job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static type_T *
|
||||||
|
ret_first_arg(int argcount, type_T **argtypes)
|
||||||
|
{
|
||||||
|
if (argcount > 0)
|
||||||
|
return argtypes[0];
|
||||||
|
return &t_void;
|
||||||
|
}
|
||||||
|
|
||||||
static type_T *ret_f_function(int argcount, type_T **argtypes);
|
static type_T *ret_f_function(int argcount, type_T **argtypes);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -849,7 +857,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"simplify", 1, 1, FEARG_1, ret_string, f_simplify},
|
{"simplify", 1, 1, FEARG_1, ret_string, f_simplify},
|
||||||
{"sin", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_sin)},
|
{"sin", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_sin)},
|
||||||
{"sinh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_sinh)},
|
{"sinh", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_sinh)},
|
||||||
{"sort", 1, 3, FEARG_1, ret_list_any, f_sort},
|
{"sort", 1, 3, FEARG_1, ret_first_arg, f_sort},
|
||||||
{"sound_clear", 0, 0, 0, ret_void, SOUND_FUNC(f_sound_clear)},
|
{"sound_clear", 0, 0, 0, ret_void, SOUND_FUNC(f_sound_clear)},
|
||||||
{"sound_playevent", 1, 2, FEARG_1, ret_number, SOUND_FUNC(f_sound_playevent)},
|
{"sound_playevent", 1, 2, FEARG_1, ret_number, SOUND_FUNC(f_sound_playevent)},
|
||||||
{"sound_playfile", 1, 2, FEARG_1, ret_number, SOUND_FUNC(f_sound_playfile)},
|
{"sound_playfile", 1, 2, FEARG_1, ret_number, SOUND_FUNC(f_sound_playfile)},
|
||||||
|
@ -807,5 +807,10 @@ def Test_call_closure_not_compiled()
|
|||||||
assert_equal('sometext', GetResult(g:Ref))
|
assert_equal('sometext', GetResult(g:Ref))
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_sort_return_type()
|
||||||
|
let res: list<number>
|
||||||
|
res = [1, 2, 3]->sort()
|
||||||
|
enddef
|
||||||
|
|
||||||
|
|
||||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
1003,
|
||||||
/**/
|
/**/
|
||||||
1002,
|
1002,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user