diff src/vim9execute.c @ 21809:15ed135796fd v8.2.1454

patch 8.2.1454: Vim9: failure invoking lambda with wrong arguments Commit: https://github.com/vim/vim/commit/79e8db9a218ef111934594024a5cd8b1f93acada Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 14 22:16:33 2020 +0200 patch 8.2.1454: Vim9: failure invoking lambda with wrong arguments Problem: Vim9: failure invoking lambda with wrong arguments. Solution: Handle invalid arguments. Add a test.
author Bram Moolenaar <Bram@vim.org>
date Fri, 14 Aug 2020 22:30:03 +0200
parents 0706bd071fa3
children 832d4d74a786
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -206,7 +206,10 @@ call_dfunc(int cdf_idx, int argcount_arg
     arg_to_add = ufunc->uf_args.ga_len - argcount;
     if (arg_to_add < 0)
     {
-	iemsg("Argument count wrong?");
+	if (arg_to_add == -1)
+	    emsg(_("E1106: one argument too many"));
+	else
+	    semsg(_("E1106: %d arguments too many"), -arg_to_add);
 	return FAIL;
     }
     if (ga_grow(&ectx->ec_stack, arg_to_add + 3