mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.1.0952: Vim9: missing type checking for any type assignment
Problem: Vim9: missing type checking for any type assignment (Ernie Rael) Solution: when assigning to a list item, if the type of the LHS item is any, then use the list item type (Yegappan Lakshmanan) fixes: #15208 closes: #16274 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
62e3014ab1
commit
92195ae72f
13
src/eval.c
13
src/eval.c
@@ -1489,8 +1489,17 @@ get_lval_list(
|
||||
return FAIL;
|
||||
|
||||
if (lp->ll_valtype != NULL && !lp->ll_range)
|
||||
{
|
||||
// use the type of the member
|
||||
lp->ll_valtype = lp->ll_valtype->tt_member;
|
||||
if (lp->ll_valtype->tt_member != NULL)
|
||||
lp->ll_valtype = lp->ll_valtype->tt_member;
|
||||
else
|
||||
// If the LHS member type is not known (VAR_ANY), then get it from
|
||||
// the list item (after indexing)
|
||||
lp->ll_valtype = typval2type(&lp->ll_li->li_tv, get_copyID(),
|
||||
&lp->ll_type_list, TVTT_DO_MEMBER);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* May need to find the item or absolute index for the second
|
||||
@@ -1994,6 +2003,7 @@ get_lval(
|
||||
|
||||
// Clear everything in "lp".
|
||||
CLEAR_POINTER(lp);
|
||||
ga_init2(&lp->ll_type_list, sizeof(type_T *), 10);
|
||||
|
||||
if (skip || (flags & GLV_COMPILING))
|
||||
{
|
||||
@@ -2178,6 +2188,7 @@ clear_lval(lval_T *lp)
|
||||
{
|
||||
vim_free(lp->ll_exp_name);
|
||||
vim_free(lp->ll_newkey);
|
||||
clear_type_list(&lp->ll_type_list);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user