summaryrefslogtreecommitdiffstats
path: root/src/vim9type.c
diff options
context:
space:
mode:
authorErnie Rael <errael@raelity.com>2023-10-21 11:45:38 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-21 11:45:38 +0200
commit3ec6c1fe3bb1b366b710d3e7226f7eed3be1801a (patch)
treedb19fb62d95aae1ff003d0a5750cdf342c3d6340 /src/vim9type.c
parentd3e277f279ed628809eb6857ea3ebcfca566ca2a (diff)
patch 9.0.2057: Vim9: no strict type checks for funcrefs varargsv9.0.2057
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>
Diffstat (limited to 'src/vim9type.c')
-rw-r--r--src/vim9type.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vim9type.c b/src/vim9type.c
index 6a5848792b..c31e51b983 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -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}".