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)
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);
}
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()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4459,
/**/
4458,
/**/