patch 9.0.2164: Vim9: can use type a func arg/return value
Problem: Vim9: can use type a func arg/return value
Solution: Check if using type as function argument or return value
closes: #13675
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/vim9instr.c b/src/vim9instr.c
index 12c83df..b7cad76 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1821,6 +1821,8 @@
type_T *actual;
actual = get_type_on_stack(cctx, argcount - i - 1);
+ if (check_type_is_value(actual) == FAIL)
+ return FAIL;
if (actual->tt_type == VAR_SPECIAL
&& i >= regular_args - ufunc->uf_def_args.ga_len)
{
@@ -1960,6 +1962,8 @@
type_T *actual = get_type_on_stack(cctx, -1 - offset);
type_T *expected;
+ if (check_type_is_value(actual) == FAIL)
+ return FAIL;
if (varargs && i >= type->tt_argcount - 1)
{
expected = type->tt_args[type->tt_argcount - 1];