forked from aniani/vim
patch 8.2.4295: Vim9: concatenating two lists may result in wrong type
Problem: Vim9: concatenating two lists may result in wrong type. Solution: Remove the type instead of using list<any>. (closes #9692)
This commit is contained in:
@@ -1216,11 +1216,10 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
|||||||
copy = list_alloc();
|
copy = list_alloc();
|
||||||
if (copy != NULL)
|
if (copy != NULL)
|
||||||
{
|
{
|
||||||
if (orig->lv_type == NULL)
|
if (orig->lv_type == NULL || top || deep)
|
||||||
copy->lv_type = NULL;
|
copy->lv_type = NULL;
|
||||||
else
|
else
|
||||||
copy->lv_type = alloc_type(top || deep
|
copy->lv_type = alloc_type(orig->lv_type);
|
||||||
? &t_list_any: orig->lv_type);
|
|
||||||
if (copyID != 0)
|
if (copyID != 0)
|
||||||
{
|
{
|
||||||
// Do this before adding the items, because one of the items may
|
// Do this before adding the items, because one of the items may
|
||||||
|
@@ -1500,6 +1500,12 @@ def Test_expr5_list_add()
|
|||||||
assert_equal([[1, 2]], lln)
|
assert_equal([[1, 2]], lln)
|
||||||
END
|
END
|
||||||
v9.CheckDefAndScriptSuccess(lines)
|
v9.CheckDefAndScriptSuccess(lines)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
var ln: list<number> = [0]
|
||||||
|
var lln: list<list<number>> = [ln + []]
|
||||||
|
END
|
||||||
|
v9.CheckDefAndScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" test multiply, divide, modulo
|
" test multiply, divide, modulo
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
4295,
|
||||||
/**/
|
/**/
|
||||||
4294,
|
4294,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user