To: vim_dev@googlegroups.com Subject: Patch 8.2.3056 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3056 Problem: Vim9: using default value in lambda gives confusing error. Solution: Pass "default_args" on the first pass to get the arguments. (closes #8455) Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.3055/src/userfunc.c 2021-06-21 20:48:54.968049445 +0200 --- src/userfunc.c 2021-06-26 19:12:16.945728987 +0200 *************** *** 1222,1228 **** s = *arg + 1; ret = get_function_args(&s, equal_arrow ? ')' : '-', NULL, types_optional ? &argtypes : NULL, types_optional, evalarg, ! NULL, NULL, TRUE, NULL, NULL); if (ret == FAIL || skip_arrow(s, equal_arrow, &ret_type, NULL) == NULL) { if (types_optional) --- 1222,1228 ---- s = *arg + 1; ret = get_function_args(&s, equal_arrow ? ')' : '-', NULL, types_optional ? &argtypes : NULL, types_optional, evalarg, ! NULL, &default_args, TRUE, NULL, NULL); if (ret == FAIL || skip_arrow(s, equal_arrow, &ret_type, NULL) == NULL) { if (types_optional) *** ../vim-8.2.3055/src/testdir/test_vim9_func.vim 2021-06-26 13:00:45.734565919 +0200 --- src/testdir/test_vim9_func.vim 2021-06-26 19:24:40.460420955 +0200 *************** *** 918,923 **** --- 918,929 ---- CheckScriptFailure(['vim9script'] + lines, 'E1168:') lines =<< trim END + var Ref: func(any, ?any): bool + Ref = (_, y = 1) => false + END + CheckDefAndScriptFailure(lines, 'E1172:') + + lines =<< trim END def ShadowLocal() var one = 1 var l = [1, 2, 3] *** ../vim-8.2.3055/src/version.c 2021-06-26 15:00:55.881276189 +0200 --- src/version.c 2021-06-26 19:14:20.489511838 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3056, /**/ -- A day without sunshine is like, well, night. /// 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 ///