To: vim_dev@googlegroups.com Subject: Patch 8.2.4459 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4459 Problem: Vim9: compiling sort() call fails with a funcref that has unknown arguments. Solution: Do not check the arguments if they are unknown at compile time. (closes #9835) Files: src/evalfunc.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.4458/src/evalfunc.c 2022-02-23 19:11:44.035997696 +0000 --- src/evalfunc.c 2022-02-23 20:57:56.790561211 +0000 *************** *** 624,629 **** --- 624,631 ---- where_T where = WHERE_INIT; args[1] = args[0]; + if (type->tt_argcount == -1) + t_func_exp.tt_argcount = -1; where.wt_index = 2; return check_type(&t_func_exp, type, TRUE, where); } *** ../vim-8.2.4458/src/testdir/test_vim9_builtin.vim 2022-02-23 19:11:44.039997685 +0000 --- src/testdir/test_vim9_builtin.vim 2022-02-23 20:57:05.530766159 +0000 *************** *** 3812,3817 **** --- 3812,3828 ---- sort([1, 2, 3], (a: any, b: any) => 1) END v9.CheckDefAndScriptSuccess(lines) + + lines =<< trim END + vim9script + def SortedList(): list + var Lambda: func: number = (a, b): number => a - b + var l = [3, 2, 1] + return l->sort(Lambda) + enddef + SortedList()->assert_equal([1, 2, 3]) + END + v9.CheckScriptSuccess(lines) enddef def Test_sort_compare_func_fails() *** ../vim-8.2.4458/src/version.c 2022-02-23 19:11:44.039997685 +0000 --- src/version.c 2022-02-23 20:58:34.474417165 +0000 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 4459, /**/ -- Bare feet magnetize sharp metal objects so they point upward from the floor -- especially in the dark. /// 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 ///