patch 8.2.4301: Vim9: type error for copy of dict
Problem: Vim9: type error for copy of dict. Solution: Do not use dict<any> but no type. (closes #9696)
This commit is contained in:
@ -306,7 +306,10 @@ dict_copy(dict_T *orig, int deep, int top, int copyID)
|
||||
orig->dv_copyID = copyID;
|
||||
orig->dv_copydict = copy;
|
||||
}
|
||||
copy->dv_type = alloc_type(top || deep ? &t_dict_any : orig->dv_type);
|
||||
if (orig->dv_type == NULL || top || deep)
|
||||
copy->dv_type = NULL;
|
||||
else
|
||||
copy->dv_type = alloc_type(orig->dv_type);
|
||||
|
||||
todo = (int)orig->dv_hashtab.ht_used;
|
||||
for (hi = orig->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi)
|
||||
|
||||
@ -745,6 +745,9 @@ def Test_copy_return_type()
|
||||
|
||||
var ndd: dict<dict<number>> = {a: {x: 1, y: 2}}
|
||||
assert_equal({x: 1, y: 2, z: 'x'}, ndd->deepcopy()['a']->extend({z: 'x'}))
|
||||
|
||||
var ldn: list<dict<number>> = [{a: 0}]->deepcopy()
|
||||
assert_equal([{a: 0}], ldn)
|
||||
enddef
|
||||
|
||||
def Test_count()
|
||||
|
||||
@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4301,
|
||||
/**/
|
||||
4300,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user