mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.4927: return type of remove() incorrect when using three arguments
Problem: Return type of remove() incorrect when using three arguments. Solution: Use first argument type when there are three arguments. (closes #10387)
This commit is contained in:
@@ -1420,13 +1420,18 @@ ret_argv(int argcount,
|
|||||||
static type_T *
|
static type_T *
|
||||||
ret_remove(int argcount,
|
ret_remove(int argcount,
|
||||||
type2_T *argtypes,
|
type2_T *argtypes,
|
||||||
type_T **decl_type UNUSED)
|
type_T **decl_type)
|
||||||
{
|
{
|
||||||
if (argcount > 0)
|
if (argcount > 0)
|
||||||
{
|
{
|
||||||
if (argtypes[0].type_curr->tt_type == VAR_LIST
|
if (argtypes[0].type_curr->tt_type == VAR_LIST
|
||||||
|| argtypes[0].type_curr->tt_type == VAR_DICT)
|
|| argtypes[0].type_curr->tt_type == VAR_DICT)
|
||||||
{
|
{
|
||||||
|
if (argcount == 3)
|
||||||
|
{
|
||||||
|
*decl_type = argtypes[0].type_decl;
|
||||||
|
return argtypes[0].type_curr;
|
||||||
|
}
|
||||||
if (argtypes[0].type_curr->tt_type
|
if (argtypes[0].type_curr->tt_type
|
||||||
== argtypes[0].type_decl->tt_type)
|
== argtypes[0].type_decl->tt_type)
|
||||||
*decl_type = argtypes[0].type_decl->tt_member;
|
*decl_type = argtypes[0].type_decl->tt_member;
|
||||||
|
@@ -3208,12 +3208,11 @@ def Test_remove()
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_remove_return_type()
|
def Test_remove_return_type()
|
||||||
var l = remove({one: [1, 2], two: [3, 4]}, 'one')
|
var l: list<number> = remove({one: [1, 2], two: [3, 4]}, 'one')
|
||||||
var res = 0
|
l->assert_equal([1, 2])
|
||||||
for n in l
|
|
||||||
res += n
|
var ll: list<number> = remove(range(3), 0, 1)
|
||||||
endfor
|
ll->assert_equal([0, 1])
|
||||||
res->assert_equal(3)
|
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_rename()
|
def Test_rename()
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4927,
|
||||||
/**/
|
/**/
|
||||||
4926,
|
4926,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user