diff src/vim9execute.c @ 21383:f25d007f90ac v8.2.1242

patch 8.2.1242: Vim9: no error if calling a function with wrong type Commit: https://github.com/vim/vim/commit/65b9545f4494abcb455400c08e51de27bc305866 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 19 14:03:09 2020 +0200 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 https://github.com/vim/vim/issues/6469)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jul 2020 14:15:04 +0200
parents 92e2ed2a2778
children 320581a133d9
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -737,6 +737,9 @@ call_def_function(
     // 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;
     }