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/vim9cmds.c b/src/vim9cmds.c
index 92605cf..392bab4 100644
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -2661,6 +2661,8 @@
// for an inline function without a specified return type. Set the
// return type here.
stack_type = get_type_on_stack(cctx, 0);
+ if (check_type_is_value(stack_type) == FAIL)
+ return NULL;
if ((check_return_type && (cctx->ctx_ufunc->uf_ret_type == NULL
|| cctx->ctx_ufunc->uf_ret_type == &t_unknown))
|| (!check_return_type