patch 8.2.2747: Vim9: not always an error for too many function arguments
Problem: Vim9: not always an error for too many function arguments.
Solution: Check for getting too many arguments.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index a49d305..e7885ad 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1336,6 +1336,16 @@
ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);
ga_init2(&ectx.ec_funcrefs, sizeof(partial_T *), 10);
+ idx = argc - ufunc->uf_args.ga_len;
+ if (idx > 0 && ufunc->uf_va_name == NULL)
+ {
+ if (idx == 1)
+ emsg(_(e_one_argument_too_many));
+ else
+ semsg(_(e_nr_arguments_too_many), idx);
+ return FAIL;
+ }
+
// Put arguments on the stack, but no more than what the function expects.
// A lambda can be called with more arguments than it uses.
for (idx = 0; idx < argc