Problem: Vim9: cannot use member of unknown type.
Solution: When type is unknown us "any". (closes #6997)
assert_equal({'0': 0, '1': 1, '2': 2}, nrd)
enddef
+def Test_assign_dict_unknown_type()
+ let lines =<< trim END
+ vim9script
+ let mylist = []
+ mylist += [#{one: 'one'}]
+ def Func()
+ let dd = mylist[0]
+ assert_equal('one', dd.one)
+ enddef
+ Func()
+ END
+ CheckScriptSuccess(lines)
+
+ # doesn't work yet
+ #lines =<< trim END
+ # vim9script
+ # let mylist = [[]]
+ # mylist[0] += [#{one: 'one'}]
+ # def Func()
+ # let dd = mylist[0][0]
+ # assert_equal('one', dd.one)
+ # enddef
+ # Func()
+ #END
+ #CheckScriptSuccess(lines)
+enddef
+
def Test_assign_lambda()
# check if assign a lambda to a variable which type is func or any.
let lines =<< trim END
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1730,
/**/
1729,
/**/
}
else
{
- // An empty list or dict has a &t_void member,
+ // An empty list or dict has a &t_unknown member,
// for a variable that implies &t_any.
if (stacktype == &t_list_empty)
lvar->lv_type = &t_list_any;
else if (stacktype == &t_dict_empty)
lvar->lv_type = &t_dict_any;
+ else if (stacktype == &t_unknown)
+ lvar->lv_type = &t_any;
else
lvar->lv_type = stacktype;
}