patch 8.2.1261: Vim9: common type of function not tested
Problem: Vim9: common type of function not tested.
Solution: Add a test. Fix uncovered problems.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index ce24dd6..0e3e01a 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1143,13 +1143,13 @@
RETURN_OK_IF_SKIP(cctx);
- if (type->tt_type == VAR_LIST)
- item_type = type->tt_member;
- else if (type->tt_type != VAR_ANY)
+ if (type->tt_type != VAR_LIST)
{
+ // cannot happen, caller has checked the type
emsg(_(e_listreq));
return FAIL;
}
+ item_type = type->tt_member;
if ((isn = generate_instr(cctx, ISN_GETITEM)) == NULL)
return FAIL;
isn->isn_arg.number = index;
@@ -4969,6 +4969,8 @@
if (var_count > 0 && is_decl)
{
+ // TODO: should we allow this, and figure out type inference from list
+ // members?
emsg(_("E1092: Cannot use a list for a declaration"));
return NULL;
}