patch 8.2.2759: Vim9: for loop infers type of loop variable
Problem: Vim9: for loop infers type of loop variable.
Solution: Do not get the member type. (closes #8102)
diff --git a/src/vim9script.c b/src/vim9script.c
index 2f2f2dc..796b7d1 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -713,7 +713,8 @@
* When "create" is TRUE this is a new variable, otherwise find and update an
* existing variable.
* "flags" can have ASSIGN_FINAL or ASSIGN_CONST.
- * When "*type" is NULL use "tv" for the type and update "*type".
+ * When "*type" is NULL use "tv" for the type and update "*type". If
+ * "do_member" is TRUE also use the member type, otherwise use "any".
*/
void
update_vim9_script_var(
@@ -721,7 +722,8 @@
dictitem_T *di,
int flags,
typval_T *tv,
- type_T **type)
+ type_T **type,
+ int do_member)
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
hashitem_T *hi;
@@ -774,7 +776,8 @@
if (sv != NULL)
{
if (*type == NULL)
- *type = typval2type(tv, get_copyID(), &si->sn_type_list);
+ *type = typval2type(tv, get_copyID(), &si->sn_type_list,
+ do_member);
sv->sv_type = *type;
}