patch 8.2.2942: Vim9: error when calling function with too few arguments
Problem: Vim9: internal error when calling function with too few arguments
Solution: Check for argument count to be too few. (closes #8325)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 9826678..c2a7de5 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -4234,6 +4234,14 @@
semsg(_(e_nr_arguments_too_many), idx);
goto failed_early;
}
+ else if (idx < 0)
+ {
+ if (idx == -1)
+ emsg(_(e_one_argument_too_few));
+ else
+ semsg(_(e_nr_arguments_too_few), -idx);
+ goto failed_early;
+ }
// Put arguments on the stack, but no more than what the function expects.
// A lambda can be called with more arguments than it uses.