patch 8.2.0465: Vim9: dead code and wrong return type
Problem: Vim9: dead code and wrong return type.
Solution: Remove dead code. Fix return type. Add more tests.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index dd31092..66eda7c 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -242,7 +242,7 @@
// Not a common type, create a new entry.
if (ga_grow(type_list, 1) == FAIL)
- return FAIL;
+ return &t_any;
type = ((type_T *)type_list->ga_data) + type_list->ga_len;
++type_list->ga_len;
type->tt_type = VAR_LIST;
@@ -269,7 +269,7 @@
// Not a common type, create a new entry.
if (ga_grow(type_list, 1) == FAIL)
- return FAIL;
+ return &t_any;
type = ((type_T *)type_list->ga_data) + type_list->ga_len;
++type_list->ga_len;
type->tt_type = VAR_DICT;
@@ -1368,6 +1368,7 @@
parse_type_member(char_u **arg, type_T *type, garray_T *type_list)
{
type_T *member_type;
+ int prev_called_emsg = called_emsg;
if (**arg != '<')
{
@@ -1380,11 +1381,9 @@
*arg = skipwhite(*arg + 1);
member_type = parse_type(arg, type_list);
- if (member_type == NULL)
- return type;
*arg = skipwhite(*arg);
- if (**arg != '>')
+ if (**arg != '>' && called_emsg == prev_called_emsg)
{
emsg(_("E1009: Missing > after type"));
return type;
@@ -1766,6 +1765,11 @@
return FAIL;
}
++p;
+ if (VIM_ISWHITE(*p))
+ {
+ emsg(_("E1074: no white space allowed after dot"));
+ return FAIL;
+ }
idx = find_exported(import->imp_sid, &p, &name_len, &ufunc, &type);
// TODO: what if it is a function?
@@ -1806,6 +1810,7 @@
char_u *name;
char_u *end = end_arg;
int res = FAIL;
+ int prev_called_emsg = called_emsg;
if (*(*arg + 1) == ':')
{
@@ -1892,7 +1897,7 @@
*arg = end;
theend:
- if (res == FAIL && error)
+ if (res == FAIL && error && called_emsg == prev_called_emsg)
semsg(_(e_var_notfound), name);
vim_free(name);
return res;