diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/evalfunc.c | 1 | ||||
-rw-r--r-- | src/list.c | 3 | ||||
-rw-r--r-- | src/testdir/test_listdict.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 15 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index e02b757e95..cea002f11c 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -603,7 +603,6 @@ arg_sort_how(type_T *type, type_T *decl_type UNUSED, argcontext_T *context) { if (type->tt_type == VAR_STRING || type->tt_type == VAR_PARTIAL - || type->tt_type == VAR_NUMBER // 1 means ignore case || type == &t_unknown || type == &t_any) return OK; diff --git a/src/list.c b/src/list.c index 578d6f1155..88f3102530 100644 --- a/src/list.c +++ b/src/list.c @@ -2198,7 +2198,8 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort) if (in_vim9script() && (check_for_list_arg(argvars, 0) == FAIL || (argvars[1].v_type != VAR_UNKNOWN - && check_for_opt_dict_arg(argvars, 2) == FAIL))) + && (check_for_string_or_func_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)))) return; if (argvars[0].v_type != VAR_LIST) diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim index 5337254fdb..89b7f041ac 100644 --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -949,7 +949,7 @@ func Test_reverse_sort_uniq() call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n')) LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] - call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 1)) + call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i')) call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l))) endif @@ -961,6 +961,16 @@ func Test_reverse_sort_uniq() call assert_fails("call sort([1, 2], function('min'), 1)", "E715:") call assert_fails("call sort([1, 2], function('invalid_func'))", "E700:") call assert_fails("call sort([1, 2], function('min'))", "E118:") + + let lines =<< trim END + call sort(['a', 'b'], 0) + END + call v9.CheckDefAndScriptFailure(lines, 'E1256: String or function required for argument 2') + + let lines =<< trim END + call sort(['a', 'b'], 1) + END + call v9.CheckDefAndScriptFailure(lines, 'E1256: String or function required for argument 2') endfunc " reduce a list, blob or string diff --git a/src/version.c b/src/version.c index 5da1833d25..b5d93fb2a7 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4455, +/**/ 4454, /**/ 4453, |