patch 9.1.0520: Vim9: incorrect type checking for modifying lists

Problem:  Vim9: incorrect type checking for modifying lists
Solution: Correctly assign the member declared types and generate
          typechecks, add disassembly test (LemonBoy)

fixes: #15090
closes: #15094

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 8e6f6e2..61fefa7 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3315,7 +3315,7 @@
 		// the initialization expression type.
 		m->ocm_type = type;
 	    }
-	    else if (m->ocm_type->tt_type != type->tt_type)
+	    else
 	    {
 		// The type of the member initialization expression is
 		// determined at run time.  Add a runtime type check.
@@ -3330,6 +3330,15 @@
 	else
 	    push_default_value(cctx, m->ocm_type->tt_type, FALSE, NULL);
 
+	if ((m->ocm_type->tt_type == VAR_DICT
+		    || m->ocm_type->tt_type == VAR_LIST)
+		&& m->ocm_type->tt_member != NULL
+		&& m->ocm_type->tt_member != &t_any
+		&& m->ocm_type->tt_member != &t_unknown)
+	    // Set the type in the list or dict, so that it can be checked,
+	    // also in legacy script.
+	    generate_SETTYPE(cctx, m->ocm_type);
+
 	generate_STORE_THIS(cctx, i);
     }