# HG changeset patch # User Bram Moolenaar # Date 1643925605 -3600 # Node ID 4ca0ee7b4f86cd18e9c9612f7ce206b5f6e05444 # Parent 763d0c455b72c1ae504e163355a5cd74a316f859 patch 8.2.4293: Vim9: when copying a list it gets type list Commit: https://github.com/vim/vim/commit/7676c158798a7c90f500cab2c12af0d47bad6026 Author: Bram Moolenaar Date: Thu Feb 3 21:47:34 2022 +0000 patch 8.2.4293: Vim9: when copying a list it gets type list Problem: Vim9: when copying a list it gets type list even when the original list did not have a type. Solution: Only set the type when the original list has a type. (closes #9692) diff --git a/src/list.c b/src/list.c --- a/src/list.c +++ b/src/list.c @@ -1216,7 +1216,11 @@ list_copy(list_T *orig, int deep, int to 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 diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -1495,6 +1495,9 @@ def Test_expr5_list_add() # result of glob() is "any", runtime type check var sl: list = glob('*.txt', false, true) + [''] + + var lln: list> = [[1] + [2]] + assert_equal([[1, 2]], lln) END v9.CheckDefAndScriptSuccess(lines) enddef diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4293, +/**/ 4292, /**/ 4291,