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)
diff --git a/src/list.c b/src/list.c
index 86c1679..3a6ea97 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1216,7 +1216,11 @@
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