# HG changeset patch # User Bram Moolenaar # Date 1643975103 -3600 # Node ID e2bb282376956eac2daac513007c6d01a0770b06 # Parent 77f6bef22e2594d04204648a0c8b4232c089879c patch 8.2.4295: Vim9: concatenating two lists may result in wrong type Commit: https://github.com/vim/vim/commit/46950b225fab2e10245a04952b2c238e0362e1b7 Author: Bram Moolenaar Date: Fri Feb 4 11:36:51 2022 +0000 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. (closes https://github.com/vim/vim/issues/9692) diff --git a/src/list.c b/src/list.c --- a/src/list.c +++ b/src/list.c @@ -1216,11 +1216,10 @@ list_copy(list_T *orig, int deep, int to copy = list_alloc(); if (copy != NULL) { - if (orig->lv_type == NULL) + if (orig->lv_type == NULL || top || deep) copy->lv_type = NULL; else - copy->lv_type = alloc_type(top || deep - ? &t_list_any: orig->lv_type); + copy->lv_type = alloc_type(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 @@ -1500,6 +1500,12 @@ def Test_expr5_list_add() assert_equal([[1, 2]], lln) END v9.CheckDefAndScriptSuccess(lines) + + lines =<< trim END + var ln: list = [0] + var lln: list> = [ln + []] + END + v9.CheckDefAndScriptSuccess(lines) enddef " test multiply, divide, modulo 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 */ /**/ + 4295, +/**/ 4294, /**/ 4293,