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<number>
+ 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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220223210448.C00251C1751%40moolenaar.net.