1
0
forked from aniani/vim

patch 9.0.2057: Vim9: no strict type checks for funcrefs varargs

Problem:  Vim9: no strict type checks for funcrefs varargs
Solution: Perform strict type checking when declaring funcrefs
          with vararg declaration, add tests

closes: #13397

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
Ernie Rael
2023-10-21 11:45:38 +02:00
committed by Christian Brabandt
parent d3e277f279
commit 3ec6c1fe3b
6 changed files with 38 additions and 6 deletions

View File

@@ -1231,6 +1231,15 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error)
type = parse_type(&p, type_gap, give_error);
if (type == NULL)
return NULL;
if ((flags & TTFLAG_VARARGS) != 0
&& type->tt_type != VAR_LIST)
{
char *tofree;
semsg(_(e_variable_arguments_type_must_be_list_str),
type_name(type, &tofree));
vim_free(tofree);
return NULL;
}
arg_type[argcount++] = type;
// Nothing comes after "...{type}".