• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision0716cc2e4a8b1a745f5509ac8ad160a0768016a3 (tree)
Time2021-07-22 03:45:04
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.3195: Vim9: unclear error when passing too many arguments to lambda

Commit: https://github.com/vim/vim/commit/c4c5642513ac41b22b7772cc880c776c69e964c9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 21 20:38:46 2021 +0200

patch 8.2.3195: Vim9: unclear error when passing too many arguments to lambda
Problem: Vim9: unclear error when passing too many arguments to lambda.
Solution: Pass the expression itself instead of "[expression]".
(closes #8604)

Change Summary

Incremental Difference

diff -r cf45fde10bdb -r 0716cc2e4a8b src/testdir/test_vim9_func.vim
--- a/src/testdir/test_vim9_func.vim Wed Jul 21 19:15:04 2021 +0200
+++ b/src/testdir/test_vim9_func.vim Wed Jul 21 20:45:04 2021 +0200
@@ -960,6 +960,12 @@
960960 echo ((a) => a)('aa', 'bb')
961961 END
962962 CheckDefAndScriptFailure(lines, 'E118:', 1)
963+
964+ lines =<< trim END
965+ echo 'aa'->((a) => a)('bb')
966+ END
967+ CheckDefFailure(lines, 'E118: Too many arguments for function: ->((a) => a)(''bb'')', 1)
968+ CheckScriptFailure(['vim9script'] + lines, 'E118: Too many arguments for function: <lambda>', 2)
963969 enddef
964970
965971 def FilterWithCond(x: string, Cond: func(string): bool): bool
diff -r cf45fde10bdb -r 0716cc2e4a8b src/version.c
--- a/src/version.c Wed Jul 21 19:15:04 2021 +0200
+++ b/src/version.c Wed Jul 21 20:45:04 2021 +0200
@@ -756,6 +756,8 @@
756756 static int included_patches[] =
757757 { /* Add new patch number below this line */
758758 /**/
759+ 3195,
760+/**/
759761 3194,
760762 /**/
761763 3193,
diff -r cf45fde10bdb -r 0716cc2e4a8b src/vim9compile.c
--- a/src/vim9compile.c Wed Jul 21 19:15:04 2021 +0200
+++ b/src/vim9compile.c Wed Jul 21 20:45:04 2021 +0200
@@ -4354,8 +4354,7 @@
43544354 }
43554355
43564356 type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
4357- if (generate_PCALL(cctx, argcount,
4358- (char_u *)"[expression]", type, FALSE) == FAIL)
4357+ if (generate_PCALL(cctx, argcount, p - 2, type, FALSE) == FAIL)
43594358 return FAIL;
43604359 }
43614360 else
Show on old repository browser