diff src/list.c @ 27859:3cb1a109e987 v8.2.4455

patch 8.2.4455: accepting one and zero for second sort() argument is strange Commit: https://github.com/vim/vim/commit/2007dd49f5cb36f944cab1cfbceb0f864e625f74 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 23 13:17:47 2022 +0000 patch 8.2.4455: accepting one and zero for second sort() argument is strange Problem: Accepting one and zero for the second sort() argument is strange. Solution: Disallow using one and zero in Vim9 script.
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Feb 2022 14:30:03 +0100
parents e2bb28237695
children 18319c0c36f9
line wrap: on
line diff
--- a/src/list.c
+++ b/src/list.c
@@ -2198,7 +2198,8 @@ do_sort_uniq(typval_T *argvars, typval_T
     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)