forked from aniani/vim
patch 8.2.4293: Vim9: when copying a list it gets type list<any>
Problem: Vim9: when copying a list it gets type list<any> even when the original list did not have a type. Solution: Only set the type when the original list has a type. (closes #9692)
This commit is contained in:
parent
02a977ea5e
commit
7676c15879
@ -1216,7 +1216,11 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
||||
copy = list_alloc();
|
||||
if (copy != NULL)
|
||||
{
|
||||
copy->lv_type = alloc_type(top || deep ? &t_list_any: orig->lv_type);
|
||||
if (orig->lv_type == NULL)
|
||||
copy->lv_type = NULL;
|
||||
else
|
||||
copy->lv_type = alloc_type(top || deep
|
||||
? &t_list_any: orig->lv_type);
|
||||
if (copyID != 0)
|
||||
{
|
||||
// Do this before adding the items, because one of the items may
|
||||
|
@ -1495,6 +1495,9 @@ def Test_expr5_list_add()
|
||||
|
||||
# result of glob() is "any", runtime type check
|
||||
var sl: list<string> = glob('*.txt', false, true) + ['']
|
||||
|
||||
var lln: list<list<number>> = [[1] + [2]]
|
||||
assert_equal([[1, 2]], lln)
|
||||
END
|
||||
v9.CheckDefAndScriptSuccess(lines)
|
||||
enddef
|
||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4293,
|
||||
/**/
|
||||
4292,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user