diff src/list.c @ 27535:e2bb28237695 v8.2.4295

patch 8.2.4295: Vim9: concatenating two lists may result in wrong type Commit: https://github.com/vim/vim/commit/46950b225fab2e10245a04952b2c238e0362e1b7 Author: Bram Moolenaar <Bram@vim.org> 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<any>. (closes https://github.com/vim/vim/issues/9692)
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Feb 2022 12:45:03 +0100
parents 4ca0ee7b4f86
children 3cb1a109e987
line wrap: on
line diff
--- 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