To: vim_dev@googlegroups.com Subject: Patch 8.2.3195 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3195 Problem: Vim9: unclear error when passing too many arguments to lambda. Solution: Pass the expression itself instead of "[expression]". (closes #8604) Files: src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.3194/src/vim9compile.c 2021-07-20 22:21:54.325987717 +0200 --- src/vim9compile.c 2021-07-21 20:28:57.429111033 +0200 *************** *** 4354,4361 **** } type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; ! if (generate_PCALL(cctx, argcount, ! (char_u *)"[expression]", type, FALSE) == FAIL) return FAIL; } else --- 4354,4360 ---- } type = ((type_T **)stack->ga_data)[stack->ga_len - 1]; ! if (generate_PCALL(cctx, argcount, p - 2, type, FALSE) == FAIL) return FAIL; } else *** ../vim-8.2.3194/src/testdir/test_vim9_func.vim 2021-07-18 13:42:25.903808826 +0200 --- src/testdir/test_vim9_func.vim 2021-07-21 20:35:55.600207013 +0200 *************** *** 960,965 **** --- 960,971 ---- echo ((a) => a)('aa', 'bb') END CheckDefAndScriptFailure(lines, 'E118:', 1) + + lines =<< trim END + echo 'aa'->((a) => a)('bb') + END + CheckDefFailure(lines, 'E118: Too many arguments for function: ->((a) => a)(''bb'')', 1) + CheckScriptFailure(['vim9script'] + lines, 'E118: Too many arguments for function: ', 2) enddef def FilterWithCond(x: string, Cond: func(string): bool): bool *** ../vim-8.2.3194/src/version.c 2021-07-21 19:09:06.248680063 +0200 --- src/version.c 2021-07-21 20:30:35.792898250 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3195, /**/ -- hundred-and-one symptoms of being an internet addict: 196. Your computer costs more than your car. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///