patch 8.2.1242: Vim9: no error if calling a function with wrong type
Problem: Vim9: no error if calling a function with wrong argument type.
Solution: Check types of arguments. (closes #6469)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 9f037a3..7ba76e5 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -737,6 +737,9 @@
// Put arguments on the stack.
for (idx = 0; idx < argc; ++idx)
{
+ if (ufunc->uf_arg_types != NULL && idx < ufunc->uf_args.ga_len
+ && check_argtype(ufunc->uf_arg_types[idx], &argv[idx]) == FAIL)
+ goto failed_early;
copy_tv(&argv[idx], STACK_TV_BOT(0));
++ectx.ec_stack.ga_len;
}