diff src/list.c @ 26935:ccb9be1cdd71 v8.2.3996

patch 8.2.3996: Vim9: type checking lacks information about declared type Commit: https://github.com/vim/vim/commit/078a46161e8b1b30bf306d6c1f4f0af7c616a989 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 4 15:17:03 2022 +0000 patch 8.2.3996: Vim9: type checking lacks information about declared type Problem: Vim9: type checking for list and dict lacks information about declared type. Solution: Add dv_decl_type and lv_decl_type. Refactor the type stack to store two types in each entry.
author Bram Moolenaar <Bram@vim.org>
date Tue, 04 Jan 2022 16:30:06 +0100
parents 6cdf92e77a91
children 7045e9308ca3
line wrap: on
line diff
--- a/src/list.c
+++ b/src/list.c
@@ -271,6 +271,7 @@ list_free_list(list_T  *l)
 	l->lv_used_next->lv_used_prev = l->lv_used_prev;
 
     free_type(l->lv_type);
+    free_type(l->lv_decl_type);
     vim_free(l);
 }
 
@@ -1025,6 +1026,8 @@ flatten_common(typval_T *argvars, typval
 	// The type will change.
 	free_type(l->lv_type);
 	l->lv_type = NULL;
+	free_type(l->lv_decl_type);
+	l->lv_decl_type = NULL;
     }
     else
     {
@@ -1220,6 +1223,7 @@ list_copy(list_T *orig, int deep, int co
     if (copy != NULL)
     {
 	copy->lv_type = alloc_type(orig->lv_type);
+	copy->lv_decl_type = alloc_type(orig->lv_decl_type);
 	if (copyID != 0)
 	{
 	    // Do this before adding the items, because one of the items may