diff src/vim9expr.c @ 27573:68eac9355e49 v8.2.4313

patch 8.2.4313: Vim9: cannot change type of list after making a slice Commit: https://github.com/vim/vim/commit/5f4ef5f5e5529c147c2274cd0f6416e2546d6fc7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 6 18:36:53 2022 +0000 patch 8.2.4313: Vim9: cannot change type of list after making a slice Problem: Vim9: cannot change type of list after making a slice. Solution: Adjust the declared member type. (closes https://github.com/vim/vim/issues/9696)
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Feb 2022 19:45:02 +0100
parents ce4c2f4ce1f9
children e311a80f8cbe
line wrap: on
line diff
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -182,6 +182,9 @@ compile_member(int is_slice, int *keepin
 		     vartype == VAR_LIST ?  ISN_LISTSLICE : ISN_ANYSLICE,
 							    2) == FAIL)
 		return FAIL;
+	    // a copy is made so the member type is no longer declared
+	    if (typep->type_decl->tt_type == VAR_LIST)
+		typep->type_decl = &t_list_any;
 	}
 	else
 	{