mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4287: cannot assign empty list with type to variable with list type
Problem: Cannot assign empty list with any list type to variable with specific list type. Solution: Use unknown list type for empty list if the specified type is any.
This commit is contained in:
@@ -344,7 +344,11 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int flags)
|
||||
list_T *l = tv->vval.v_list;
|
||||
listitem_T *li;
|
||||
|
||||
if (l == NULL || (l->lv_first == NULL && l->lv_type == NULL))
|
||||
// An empty list has type list<unknown>, unless the type was specified
|
||||
// and is not list<any>. This matters when assigning to a variable
|
||||
// with a specific list type.
|
||||
if (l == NULL || (l->lv_first == NULL
|
||||
&& (l->lv_type == NULL || l->lv_type->tt_member == &t_any)))
|
||||
return &t_list_empty;
|
||||
if ((flags & TVTT_DO_MEMBER) == 0)
|
||||
return &t_list_any;
|
||||
|
Reference in New Issue
Block a user