To: vim_dev@googlegroups.com Subject: Patch 8.2.3188 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3188 Problem: Vim9: argument types are not checked at compile time. Solution: Add several more type checks, also at runtime. (Yegappan Lakshmanan, closes #8587) Files: src/blob.c, src/channel.c, src/clientserver.c, src/cmdexpand.c, src/cmdhist.c, src/dict.c, src/diff.c, src/errors.h, src/eval.c, src/evalbuffer.c, src/evalfunc.c, src/evalvars.c, src/evalwindow.c, src/filepath.c, src/globals.h, src/insexpand.c, src/job.c, src/list.c, src/map.c, src/match.c, src/proto/typval.pro, src/quickfix.c, src/search.c, src/sign.c, src/strings.c, src/terminal.c, src/testdir/test_blob.vim, src/testdir/test_gui.vim, src/testdir/test_vim9_builtin.vim, src/testing.c, src/textprop.c, src/time.c, src/typval.c *** ../vim-8.2.3187/src/blob.c 2021-04-17 21:22:46.351232494 +0200 --- src/blob.c 2021-07-20 17:46:37.595626904 +0200 *************** *** 415,423 **** blob_remove(typval_T *argvars, typval_T *rettv) { int error = FALSE; ! long idx = (long)tv_get_number_chk(&argvars[1], &error); long end; if (!error) { blob_T *b = argvars[0].vval.v_blob; --- 415,430 ---- blob_remove(typval_T *argvars, typval_T *rettv) { int error = FALSE; ! long idx; long end; + if (in_vim9script() + && (check_for_blob_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + + idx = (long)tv_get_number_chk(&argvars[1], &error); if (!error) { blob_T *b = argvars[0].vval.v_blob; *** ../vim-8.2.3187/src/channel.c 2021-07-10 13:15:35.291053015 +0200 --- src/channel.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 4270,4275 **** --- 4270,4280 ---- rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); if (channel == NULL) return; *************** *** 4330,4335 **** --- 4335,4346 ---- rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_string_or_blob_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + if (argvars[1].v_type == VAR_BLOB) { text = argvars[1].vval.v_blob->bv_ga.ga_data; *************** *** 4815,4823 **** void f_ch_getbufnr(typval_T *argvars, typval_T *rettv) { ! channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); rettv->vval.v_number = -1; if (channel != NULL) { char_u *what = tv_get_string(&argvars[1]); --- 4826,4841 ---- void f_ch_getbufnr(typval_T *argvars, typval_T *rettv) { ! channel_T *channel; rettv->vval.v_number = -1; + + if (in_vim9script() + && (check_for_chan_or_job_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + + channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); if (channel != NULL) { char_u *what = tv_get_string(&argvars[1]); *************** *** 4894,4899 **** --- 4912,4918 ---- // Don't open a file in restricted mode. if (check_restricted() || check_secure()) return; + if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) *** ../vim-8.2.3187/src/clientserver.c 2021-07-15 12:48:08.803766853 +0200 --- src/clientserver.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 793,798 **** --- 793,807 ---- { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_number_arg(argvars, 3) == FAIL))) + return; + #ifdef FEAT_CLIENTSERVER remote_common(argvars, rettv, TRUE); #endif *************** *** 891,898 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; serverid = tv_get_string_chk(&argvars[0]); --- 900,906 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; serverid = tv_get_string_chk(&argvars[0]); *************** *** 932,937 **** --- 940,952 ---- { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL)) + return; + #ifdef FEAT_CLIENTSERVER remote_common(argvars, rettv, FALSE); #endif *** ../vim-8.2.3187/src/cmdexpand.c 2021-06-13 18:38:44.688673497 +0200 --- src/cmdexpand.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 2891,2896 **** --- 2891,2902 ---- int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH | WILD_NO_BEEP; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_bool_arg(argvars, 2) == FAIL)) + return; + if (argvars[1].v_type != VAR_STRING) { semsg(_(e_invarg2), "type must be a string"); *** ../vim-8.2.3187/src/cmdhist.c 2021-07-15 12:48:08.807766847 +0200 --- src/cmdhist.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 599,606 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; str = tv_get_string_chk(&argvars[0]); // NULL on type error --- 599,605 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; str = tv_get_string_chk(&argvars[0]); // NULL on type error *** ../vim-8.2.3187/src/dict.c 2021-06-02 11:49:19.268325065 +0200 --- src/dict.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 1340,1345 **** --- 1340,1350 ---- char_u *key; dictitem_T *di; + if (in_vim9script() + && (check_for_dict_arg(argvars, 0) == FAIL + || check_for_string_or_number_arg(argvars, 1) == FAIL)) + return; + if (argvars[2].v_type != VAR_UNKNOWN) semsg(_(e_toomanyarg), "remove()"); else if ((d = argvars[0].vval.v_dict) != NULL *** ../vim-8.2.3187/src/diff.c 2021-07-17 19:11:03.576709073 +0200 --- src/diff.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 3294,3302 **** int col; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_number_arg(argvars, 1) == FAIL)) return; --- 3294,3300 ---- int col; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars,0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; *** ../vim-8.2.3187/src/errors.h 2021-07-19 21:45:03.828786195 +0200 --- src/errors.h 2021-07-20 17:46:37.599626907 +0200 *************** *** 520,522 **** --- 520,528 ---- EXTERN char e_setdigraphlist_argument_must_be_list_of_lists_with_two_items[] INIT(= N_("E1216: setdigraphlist() argument must be a list of lists with two items")); #endif + EXTERN char e_blob_required_for_argument_nr[] + INIT(= N_("E1217: Blob required for argument %d")); + EXTERN char e_chan_or_job_required_for_argument_nr[] + INIT(= N_("E1218: Channel or Job required for argument %d")); + EXTERN char e_job_required_for_argument_nr[] + INIT(= N_("E1219: Job required for argument %d")); *** ../vim-8.2.3187/src/eval.c 2021-07-18 20:40:29.550272444 +0200 --- src/eval.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 4184,4189 **** --- 4184,4198 ---- void f_slice(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && ((argvars[0].v_type != VAR_LIST + && argvars[0].v_type != VAR_BLOB + && argvars[0].v_type != VAR_STRING + && check_for_list_arg(argvars, 0) == FAIL) + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + if (check_can_index(argvars, TRUE, FALSE) == OK) { copy_tv(argvars, rettv); *** ../vim-8.2.3187/src/evalbuffer.c 2021-03-27 19:08:56.349496510 +0100 --- src/evalbuffer.c 2021-07-20 17:46:37.599626907 +0200 *************** *** 387,392 **** --- 387,398 ---- int error = FALSE; char_u *name; + if (in_vim9script() + && (check_for_opt_string_or_number_arg(argvars, 0) == FAIL + || (argvars[0].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 1) == FAIL))) + return; + if (argvars[0].v_type == VAR_UNKNOWN) buf = curbuf; else *************** *** 459,464 **** --- 465,476 ---- tabpage_T *tp; win_T *wp; + if (in_vim9script() + && (check_for_buffer_arg(argvars, 0) == FAIL + || check_for_lnum_arg(argvars, 1) == FAIL + || check_for_opt_lnum_arg(argvars, 2) == FAIL)) + return; + buf = tv_get_buf(&argvars[0], FALSE); if (buf == NULL) { *************** *** 727,732 **** --- 739,750 ---- linenr_T end = 1; buf_T *buf; + if (in_vim9script() + && (check_for_buffer_arg(argvars, 0) == FAIL + || check_for_lnum_arg(argvars, 1) == FAIL + || check_for_opt_lnum_arg(argvars, 2) == FAIL)) + return; + buf = tv_get_buf_from_arg(&argvars[0]); if (buf != NULL) { *** ../vim-8.2.3187/src/evalfunc.c 2021-07-19 20:07:16.697295626 +0200 --- src/evalfunc.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 300,306 **** } /* ! * Check "type" is a list or a blob. */ static int arg_list_or_blob(type_T *type, argcontext_T *context) --- 300,306 ---- } /* ! * Check "type" is a list of 'any' or a blob. */ static int arg_list_or_blob(type_T *type, argcontext_T *context) *************** *** 324,329 **** --- 324,356 ---- arg_type_mismatch(&t_string, type, context->arg_idx + 1); return FAIL; } + + /* + * Check "type" is a string or a number (buffer) + */ + static int + arg_buffer(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_NUMBER) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; + } + + /* + * Check "type" is a string or a number (line) + */ + static int + arg_lnum(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_NUMBER) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; + } + /* * Check "type" is a string or a list of strings. */ *************** *** 359,364 **** --- 386,404 ---- } /* + * Check "type" is a string or a blob + */ + static int + arg_string_or_blob(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_STRING || type->tt_type == VAR_BLOB) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; + } + + /* * Check "type" is a list of 'any' or a dict of 'any'. */ static int *************** *** 372,377 **** --- 412,432 ---- } /* + * Check "type" is a list of 'any' or a dict of 'any' or a blob. + */ + static int + arg_list_or_dict_or_blob(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_LIST + || type->tt_type == VAR_DICT + || type->tt_type == VAR_BLOB) + return OK; + arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); + return FAIL; + } + + /* * Check "type" is a job. */ static int *************** *** 386,393 **** static int arg_chan_or_job(type_T *type, argcontext_T *context) { ! if (type->tt_type == VAR_ANY || ! type->tt_type == VAR_CHANNEL || type->tt_type == VAR_JOB) return OK; arg_type_mismatch(&t_channel, type, context->arg_idx + 1); return FAIL; --- 441,449 ---- static int arg_chan_or_job(type_T *type, argcontext_T *context) { ! if (type->tt_type == VAR_ANY ! || type->tt_type == VAR_CHANNEL ! || type->tt_type == VAR_JOB) return OK; arg_type_mismatch(&t_channel, type, context->arg_idx + 1); return FAIL; *************** *** 457,462 **** --- 513,532 ---- } /* + * Check "type" is a dict of 'any' or a string + */ + static int + arg_dict_any_or_string(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_DICT + || type->tt_type == VAR_STRING) + return OK; + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; + } + + /* * Check "type" which is the third argument of extend(). */ static int *************** *** 471,476 **** --- 541,605 ---- return OK; } + /* + * Check "type" which is the second argument of remove(). + */ + static int + arg_remove2(type_T *type, argcontext_T *context) + { + type_T *first_type = context->arg_types[context->arg_idx - 1]; + + if (first_type->tt_type == VAR_LIST || first_type->tt_type == VAR_BLOB) + return arg_number(type, context); + if (first_type->tt_type == VAR_DICT) + return arg_string_or_nr(type, context); + return OK; + } + + /* + * Check "type" which is the first argument of slice(). + */ + static int + arg_slice1(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_LIST + || type->tt_type == VAR_BLOB + || type->tt_type == VAR_STRING) + return OK; + + arg_type_mismatch(&t_list_any, type, context->arg_idx + 1); + return FAIL; + } + + /* + * Check "type" which is the first argument of count(). + */ + static int + arg_count1(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_STRING + || type->tt_type == VAR_LIST + || type->tt_type == VAR_DICT) + return OK; + + arg_type_mismatch(&t_string, type, context->arg_idx + 1); + return FAIL; + } + + /* + * Check "type" which is the first argument of cursor(). + */ + static int + arg_cursor1(type_T *type, argcontext_T *context) + { + if (type->tt_type == VAR_NUMBER + || type->tt_type == VAR_STRING + || type->tt_type == VAR_LIST) + return OK; + + arg_type_mismatch(&t_number, type, context->arg_idx + 1); + return FAIL; + } /* * Lists of functions that check the argument types of a builtin function. *************** *** 481,487 **** static argcheck_T arg1_dict_any[] = {arg_dict_any}; static argcheck_T arg1_job[] = {arg_job}; static argcheck_T arg1_list_any[] = {arg_list_any}; ! static argcheck_T arg1_list_nr[] = {arg_list_number}; static argcheck_T arg1_list_string[] = {arg_list_string}; static argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; static argcheck_T arg1_string_or_nr[] = {arg_string_or_nr}; --- 610,616 ---- static argcheck_T arg1_dict_any[] = {arg_dict_any}; static argcheck_T arg1_job[] = {arg_job}; static argcheck_T arg1_list_any[] = {arg_list_any}; ! static argcheck_T arg1_list_number[] = {arg_list_number}; static argcheck_T arg1_list_string[] = {arg_list_string}; static argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; static argcheck_T arg1_string_or_nr[] = {arg_string_or_nr}; *************** *** 490,524 **** static argcheck_T arg1_list_or_blob[] = {arg_list_or_blob}; static argcheck_T arg1_list_or_dict[] = {arg_list_or_dict}; static argcheck_T arg1_chan_or_job[] = {arg_chan_or_job}; static argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr}; static argcheck_T arg2_number[] = {arg_number, arg_number}; static argcheck_T arg2_string[] = {arg_string, arg_string}; static argcheck_T arg2_string_number[] = {arg_string, arg_number}; static argcheck_T arg2_list_nr[] = {arg_list_number, arg_list_number}; static argcheck_T arg2_nr_string[] = {arg_number, arg_string}; static argcheck_T arg2_dict_string[] = {arg_dict_any, arg_string}; static argcheck_T arg2_dict_string_or_nr[] = {arg_dict_any, arg_string_or_nr}; static argcheck_T arg2_string_dict[] = {arg_string, arg_dict_any}; ! static argcheck_T arg2_string_nr[] = {arg_string, arg_number}; static argcheck_T arg2_string_bool[] = {arg_string, arg_bool}; //static argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev}; static argcheck_T arg2_str_or_nr_or_list_dict[] = {arg_str_or_nr_or_list, arg_dict_any}; static argcheck_T arg2_string_or_list_dict[] = {arg_string_or_list_any, arg_dict_any}; static argcheck_T arg2_string_or_nr_string[] = {arg_string_or_nr, arg_string}; static argcheck_T arg2_string_or_nr_nr[] = {arg_string_or_nr, arg_number}; static argcheck_T arg2_chan_or_job_dict[] = {arg_chan_or_job, arg_dict_any}; static argcheck_T arg2_nr_dict_any[] = {arg_number, arg_dict_any}; - //static argcheck_T arg2_string_number[] = {arg_string, arg_number}; static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; static argcheck_T arg3_number[] = {arg_number, arg_number, arg_number}; static argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool}; static argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number}; static argcheck_T arg2_execute[] = {arg_string_or_list_string, arg_string}; static argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3}; static argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3}; static argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number}; static argcheck_T arg3_setbufline[] = {arg_string_or_nr, arg_string_or_nr, arg_str_or_nr_or_list}; static argcheck_T arg2_setline[] = {arg_string_or_nr, NULL}; static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string}; static argcheck_T arg4_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number}; --- 619,692 ---- static argcheck_T arg1_list_or_blob[] = {arg_list_or_blob}; static argcheck_T arg1_list_or_dict[] = {arg_list_or_dict}; static argcheck_T arg1_chan_or_job[] = {arg_chan_or_job}; + static argcheck_T arg1_dict_or_string[] = {arg_dict_any_or_string}; static argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr}; static argcheck_T arg2_number[] = {arg_number, arg_number}; static argcheck_T arg2_string[] = {arg_string, arg_string}; static argcheck_T arg2_string_number[] = {arg_string, arg_number}; static argcheck_T arg2_list_nr[] = {arg_list_number, arg_list_number}; + static argcheck_T arg2_list_any_string[] = {arg_list_any, arg_string}; + static argcheck_T arg2_list_any_number[] = {arg_list_any, arg_number}; + static argcheck_T arg2_list_number_bool[] = {arg_list_number, arg_bool}; static argcheck_T arg2_nr_string[] = {arg_number, arg_string}; + static argcheck_T arg2_nr_bool[] = {arg_number, arg_bool}; + static argcheck_T arg2_nr_list[] = {arg_number, arg_list_any}; static argcheck_T arg2_dict_string[] = {arg_dict_any, arg_string}; static argcheck_T arg2_dict_string_or_nr[] = {arg_dict_any, arg_string_or_nr}; static argcheck_T arg2_string_dict[] = {arg_string, arg_dict_any}; ! static argcheck_T arg2_string_list_nr[] = {arg_string, arg_list_number}; static argcheck_T arg2_string_bool[] = {arg_string, arg_bool}; + static argcheck_T arg2_job_dict[] = {arg_job, arg_dict_any}; + static argcheck_T arg2_job_string_or_number[] = {arg_job, arg_string_or_nr}; //static argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev}; static argcheck_T arg2_str_or_nr_or_list_dict[] = {arg_str_or_nr_or_list, arg_dict_any}; static argcheck_T arg2_string_or_list_dict[] = {arg_string_or_list_any, arg_dict_any}; static argcheck_T arg2_string_or_nr_string[] = {arg_string_or_nr, arg_string}; static argcheck_T arg2_string_or_nr_nr[] = {arg_string_or_nr, arg_number}; + static argcheck_T arg2_string_or_nr_bool[] = {arg_string_or_nr, arg_bool}; static argcheck_T arg2_chan_or_job_dict[] = {arg_chan_or_job, arg_dict_any}; + static argcheck_T arg2_chan_or_job_string[] = {arg_chan_or_job, arg_string}; static argcheck_T arg2_nr_dict_any[] = {arg_number, arg_dict_any}; static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; static argcheck_T arg3_number[] = {arg_number, arg_number, arg_number}; + static argcheck_T arg3_number_number_dict[] = {arg_number, arg_number, arg_dict_any}; + static argcheck_T arg3_number_string_any[] = {arg_number, arg_string, NULL}; static argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool}; static argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number}; + static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool}; + static argcheck_T arg3_string_bool_bool[] = {arg_string, arg_bool, arg_bool}; + static argcheck_T arg3_string_bool_dict[] = {arg_string, arg_bool, arg_dict_any}; + static argcheck_T arg3_list_string_dict[] = {arg_list_any, arg_string, arg_dict_any}; + static argcheck_T arg3_dict_number_number[] = {arg_dict_any, arg_number, arg_number}; + static argcheck_T arg3_string_or_nr_nr_bool[] = {arg_string_or_nr, arg_number, arg_bool}; + static argcheck_T arg3_bufnr_lnum_lnum[] = {arg_buffer, arg_lnum, arg_lnum}; + static argcheck_T arg4_number_number_string_any[] = {arg_number, arg_number, arg_string, NULL}; + static argcheck_T arg5_number[] = {arg_number, arg_number, arg_number, arg_number, arg_number}; + static argcheck_T arg4_browse[] = {arg_bool, arg_string, arg_string, arg_string}; + static argcheck_T arg3_chanexpr[] = {arg_chan_or_job, NULL, arg_dict_any}; + static argcheck_T arg3_chanraw[] = {arg_chan_or_job, arg_string_or_blob, arg_dict_any}; + static argcheck_T arg4_count[] = {arg_count1, NULL, arg_bool, arg_number}; + static argcheck_T arg3_cursor[] = {arg_cursor1, arg_number, arg_number}; + static argcheck_T arg2_deepcopy[] = {NULL, arg_bool}; static argcheck_T arg2_execute[] = {arg_string_or_list_string, arg_string}; static argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3}; static argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3}; + static argcheck_T arg4_glob[] = {arg_string, arg_bool, arg_bool, arg_bool}; + static argcheck_T arg5_globpath[] = {arg_string, arg_string, arg_bool, arg_bool, arg_bool}; + static argcheck_T arg4_index[] = {arg_list_or_blob, NULL, arg_number, arg_bool}; static argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number}; + static argcheck_T arg4_maparg[] = {arg_string, arg_string, arg_bool, arg_bool}; + static argcheck_T arg4_remote_expr[] = {arg_string, arg_string, arg_string, arg_number}; + static argcheck_T arg3_remove[] = {arg_list_or_dict_or_blob, arg_remove2, arg_number}; static argcheck_T arg3_setbufline[] = {arg_string_or_nr, arg_string_or_nr, arg_str_or_nr_or_list}; static argcheck_T arg2_setline[] = {arg_string_or_nr, NULL}; + static argcheck_T arg4_setloclist[] = {arg_number, arg_list_any, arg_string, arg_dict_any}; + static argcheck_T arg3_setqflist[] = {arg_list_any, arg_string, arg_dict_any}; + static argcheck_T arg2_settagstack[] = {arg_number, arg_dict_any, arg_string}; + static argcheck_T arg2_sign_getplaced[] = {arg_string_or_nr, arg_dict_any}; + static argcheck_T arg3_slice[] = {arg_slice1, arg_number, arg_number}; + static argcheck_T arg4_strpart[] = {arg_string, arg_number, arg_number, arg_bool}; + static argcheck_T arg2_term_setansicolors[] = {arg_string_or_nr, arg_list_any}; static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string}; static argcheck_T arg4_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number}; *************** *** 866,872 **** NULL #endif }, ! {"browse", 4, 4, 0, NULL, ret_string, f_browse}, {"browsedir", 2, 2, 0, arg2_string, ret_string, f_browsedir}, --- 1034,1040 ---- NULL #endif }, ! {"browse", 4, 4, 0, arg4_browse, ret_string, f_browse}, {"browsedir", 2, 2, 0, arg2_string, ret_string, f_browsedir}, *************** *** 878,884 **** ret_number_bool, f_bufexists}, {"buffer_name", 0, 1, FEARG_1, arg1_string_or_nr, // obsolete ret_string, f_bufname}, ! {"buffer_number", 0, 1, FEARG_1, NULL, // obsolete ret_number, f_bufnr}, {"buflisted", 1, 1, FEARG_1, arg1_string_or_nr, ret_number_bool, f_buflisted}, --- 1046,1052 ---- ret_number_bool, f_bufexists}, {"buffer_name", 0, 1, FEARG_1, arg1_string_or_nr, // obsolete ret_string, f_bufname}, ! {"buffer_number", 0, 1, FEARG_1, arg2_string_or_nr_bool, // obsolete ret_number, f_bufnr}, {"buflisted", 1, 1, FEARG_1, arg1_string_or_nr, ret_number_bool, f_buflisted}, *************** *** 888,894 **** ret_number_bool, f_bufloaded}, {"bufname", 0, 1, FEARG_1, arg1_string_or_nr, ret_string, f_bufname}, ! {"bufnr", 0, 2, FEARG_1, NULL, ret_number, f_bufnr}, {"bufwinid", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_bufwinid}, --- 1056,1062 ---- ret_number_bool, f_bufloaded}, {"bufname", 0, 1, FEARG_1, arg1_string_or_nr, ret_string, f_bufname}, ! {"bufnr", 0, 2, FEARG_1, arg2_string_or_nr_bool, ret_number, f_bufnr}, {"bufwinid", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_bufwinid}, *************** *** 896,904 **** ret_number, f_bufwinnr}, {"byte2line", 1, 1, FEARG_1, arg1_number, ret_number, f_byte2line}, ! {"byteidx", 2, 2, FEARG_1, arg2_string_nr, ret_number, f_byteidx}, ! {"byteidxcomp", 2, 2, FEARG_1, arg2_string_nr, ret_number, f_byteidxcomp}, {"call", 2, 3, FEARG_1, NULL, ret_any, f_call}, --- 1064,1072 ---- ret_number, f_bufwinnr}, {"byte2line", 1, 1, FEARG_1, arg1_number, ret_number, f_byte2line}, ! {"byteidx", 2, 2, FEARG_1, arg2_string_number, ret_number, f_byteidx}, ! {"byteidxcomp", 2, 2, FEARG_1, arg2_string_number, ret_number, f_byteidxcomp}, {"call", 2, 3, FEARG_1, NULL, ret_any, f_call}, *************** *** 910,920 **** ret_void, JOB_FUNC(f_ch_close)}, {"ch_close_in", 1, 1, FEARG_1, arg1_chan_or_job, ret_void, JOB_FUNC(f_ch_close_in)}, ! {"ch_evalexpr", 2, 3, FEARG_1, NULL, ret_any, JOB_FUNC(f_ch_evalexpr)}, ! {"ch_evalraw", 2, 3, FEARG_1, NULL, ret_any, JOB_FUNC(f_ch_evalraw)}, ! {"ch_getbufnr", 2, 2, FEARG_1, NULL, ret_number, JOB_FUNC(f_ch_getbufnr)}, {"ch_getjob", 1, 1, FEARG_1, arg1_chan_or_job, ret_job, JOB_FUNC(f_ch_getjob)}, --- 1078,1088 ---- ret_void, JOB_FUNC(f_ch_close)}, {"ch_close_in", 1, 1, FEARG_1, arg1_chan_or_job, ret_void, JOB_FUNC(f_ch_close_in)}, ! {"ch_evalexpr", 2, 3, FEARG_1, arg3_chanexpr, ret_any, JOB_FUNC(f_ch_evalexpr)}, ! {"ch_evalraw", 2, 3, FEARG_1, arg3_chanraw, ret_any, JOB_FUNC(f_ch_evalraw)}, ! {"ch_getbufnr", 2, 2, FEARG_1, arg2_chan_or_job_string, ret_number, JOB_FUNC(f_ch_getbufnr)}, {"ch_getjob", 1, 1, FEARG_1, arg1_chan_or_job, ret_job, JOB_FUNC(f_ch_getjob)}, *************** *** 932,940 **** ret_blob, JOB_FUNC(f_ch_readblob)}, {"ch_readraw", 1, 2, FEARG_1, arg2_chan_or_job_dict, ret_string, JOB_FUNC(f_ch_readraw)}, ! {"ch_sendexpr", 2, 3, FEARG_1, NULL, ret_void, JOB_FUNC(f_ch_sendexpr)}, ! {"ch_sendraw", 2, 3, FEARG_1, NULL, ret_void, JOB_FUNC(f_ch_sendraw)}, {"ch_setoptions", 2, 2, FEARG_1, arg2_chan_or_job_dict, ret_void, JOB_FUNC(f_ch_setoptions)}, --- 1100,1108 ---- ret_blob, JOB_FUNC(f_ch_readblob)}, {"ch_readraw", 1, 2, FEARG_1, arg2_chan_or_job_dict, ret_string, JOB_FUNC(f_ch_readraw)}, ! {"ch_sendexpr", 2, 3, FEARG_1, arg3_chanexpr, ret_void, JOB_FUNC(f_ch_sendexpr)}, ! {"ch_sendraw", 2, 3, FEARG_1, arg3_chanraw, ret_void, JOB_FUNC(f_ch_sendraw)}, {"ch_setoptions", 2, 2, FEARG_1, arg2_chan_or_job_dict, ret_void, JOB_FUNC(f_ch_setoptions)}, *************** *** 958,966 **** ret_void, f_clearmatches}, {"col", 1, 1, FEARG_1, arg1_string_or_list_any, ret_number, f_col}, ! {"complete", 2, 2, FEARG_2, NULL, ret_void, f_complete}, ! {"complete_add", 1, 1, FEARG_1, NULL, ret_number, f_complete_add}, {"complete_check", 0, 0, 0, NULL, ret_number_bool, f_complete_check}, --- 1126,1134 ---- ret_void, f_clearmatches}, {"col", 1, 1, FEARG_1, arg1_string_or_list_any, ret_number, f_col}, ! {"complete", 2, 2, FEARG_2, arg2_nr_list, ret_void, f_complete}, ! {"complete_add", 1, 1, FEARG_1, arg1_dict_or_string, ret_number, f_complete_add}, {"complete_check", 0, 0, 0, NULL, ret_number_bool, f_complete_check}, *************** *** 974,984 **** ret_float, FLOAT_FUNC(f_cos)}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_cosh)}, ! {"count", 2, 4, FEARG_1, NULL, ret_number, f_count}, {"cscope_connection",0,3, 0, NULL, ret_number, f_cscope_connection}, ! {"cursor", 1, 3, FEARG_1, NULL, ret_number, f_cursor}, {"debugbreak", 1, 1, FEARG_1, arg1_number, ret_number, --- 1142,1152 ---- ret_float, FLOAT_FUNC(f_cos)}, {"cosh", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_cosh)}, ! {"count", 2, 4, FEARG_1, arg4_count, ret_number, f_count}, {"cscope_connection",0,3, 0, NULL, ret_number, f_cscope_connection}, ! {"cursor", 1, 3, FEARG_1, arg3_cursor, ret_number, f_cursor}, {"debugbreak", 1, 1, FEARG_1, arg1_number, ret_number, *************** *** 988,998 **** NULL #endif }, ! {"deepcopy", 1, 2, FEARG_1, NULL, ret_first_arg, f_deepcopy}, {"delete", 1, 2, FEARG_1, arg2_string, ret_number_bool, f_delete}, ! {"deletebufline", 2, 3, FEARG_1, NULL, ret_number_bool, f_deletebufline}, {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, --- 1156,1166 ---- NULL #endif }, ! {"deepcopy", 1, 2, FEARG_1, arg2_deepcopy, ret_first_arg, f_deepcopy}, {"delete", 1, 2, FEARG_1, arg2_string, ret_number_bool, f_delete}, ! {"deletebufline", 2, 3, FEARG_1, arg3_bufnr_lnum_lnum, ret_number_bool, f_deletebufline}, {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, *************** *** 1022,1028 **** ret_number_bool, f_exists}, {"exp", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_exp)}, ! {"expand", 1, 3, FEARG_1, NULL, ret_any, f_expand}, {"expandcmd", 1, 1, FEARG_1, arg1_string, ret_string, f_expandcmd}, --- 1190,1196 ---- ret_number_bool, f_exists}, {"exp", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_exp)}, ! {"expand", 1, 3, FEARG_1, arg3_string_bool_bool, ret_any, f_expand}, {"expandcmd", 1, 1, FEARG_1, arg1_string, ret_string, f_expandcmd}, *************** *** 1044,1052 **** ret_string, f_finddir}, {"findfile", 1, 3, FEARG_1, arg3_string_string_nr, ret_string, f_findfile}, ! {"flatten", 1, 2, FEARG_1, NULL, ret_list_any, f_flatten}, ! {"flattennew", 1, 2, FEARG_1, NULL, ret_list_any, f_flattennew}, {"float2nr", 1, 1, FEARG_1, arg1_float_or_nr, ret_number, FLOAT_FUNC(f_float2nr)}, --- 1212,1220 ---- ret_string, f_finddir}, {"findfile", 1, 3, FEARG_1, arg3_string_string_nr, ret_string, f_findfile}, ! {"flatten", 1, 2, FEARG_1, arg2_list_any_number, ret_list_any, f_flatten}, ! {"flattennew", 1, 2, FEARG_1, arg2_list_any_number, ret_list_any, f_flattennew}, {"float2nr", 1, 1, FEARG_1, arg1_float_or_nr, ret_number, FLOAT_FUNC(f_float2nr)}, *************** *** 1082,1088 **** ret_any, f_get}, {"getbufinfo", 0, 1, FEARG_1, NULL, ret_list_dict_any, f_getbufinfo}, ! {"getbufline", 2, 3, FEARG_1, NULL, ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, NULL, ret_any, f_getbufvar}, --- 1250,1256 ---- ret_any, f_get}, {"getbufinfo", 0, 1, FEARG_1, NULL, ret_list_dict_any, f_getbufinfo}, ! {"getbufline", 2, 3, FEARG_1, arg3_bufnr_lnum_lnum, ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, NULL, ret_any, f_getbufvar}, *************** *** 1106,1112 **** ret_string, f_getcmdtype}, {"getcmdwintype", 0, 0, 0, NULL, ret_string, f_getcmdwintype}, ! {"getcompletion", 2, 3, FEARG_1, NULL, ret_list_string, f_getcompletion}, {"getcurpos", 0, 1, FEARG_1, arg1_number, ret_list_number, f_getcurpos}, --- 1274,1280 ---- ret_string, f_getcmdtype}, {"getcmdwintype", 0, 0, 0, NULL, ret_string, f_getcmdwintype}, ! {"getcompletion", 2, 3, FEARG_1, arg3_string_string_bool, ret_list_string, f_getcompletion}, {"getcurpos", 0, 1, FEARG_1, arg1_number, ret_list_number, f_getcurpos}, *************** *** 1150,1156 **** ret_list_number, f_getpos}, {"getqflist", 0, 1, 0, arg1_dict_any, ret_list_or_dict_0, f_getqflist}, ! {"getreg", 0, 3, FEARG_1, NULL, ret_getreg, f_getreg}, {"getreginfo", 0, 1, FEARG_1, arg1_string, ret_dict_any, f_getreginfo}, --- 1318,1324 ---- ret_list_number, f_getpos}, {"getqflist", 0, 1, 0, arg1_dict_any, ret_list_or_dict_0, f_getqflist}, ! {"getreg", 0, 3, FEARG_1, arg3_string_bool_bool, ret_getreg, f_getreg}, {"getreginfo", 0, 1, FEARG_1, arg1_string, ret_dict_any, f_getreginfo}, *************** *** 1158,1166 **** ret_string, f_getregtype}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, ! {"gettabvar", 2, 3, FEARG_1, NULL, ret_any, f_gettabvar}, ! {"gettabwinvar", 3, 4, FEARG_1, NULL, ret_any, f_gettabwinvar}, {"gettagstack", 0, 1, FEARG_1, arg1_number, ret_dict_any, f_gettagstack}, --- 1326,1334 ---- ret_string, f_getregtype}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, ! {"gettabvar", 2, 3, FEARG_1, arg3_number_string_any, ret_any, f_gettabvar}, ! {"gettabwinvar", 3, 4, FEARG_1, arg4_number_number_string_any, ret_any, f_gettabwinvar}, {"gettagstack", 0, 1, FEARG_1, arg1_number, ret_dict_any, f_gettagstack}, *************** *** 1174,1194 **** ret_number, f_getwinposx}, {"getwinposy", 0, 0, 0, NULL, ret_number, f_getwinposy}, ! {"getwinvar", 2, 3, FEARG_1, NULL, ret_any, f_getwinvar}, ! {"glob", 1, 4, FEARG_1, NULL, ret_any, f_glob}, {"glob2regpat", 1, 1, FEARG_1, arg1_string, ret_string, f_glob2regpat}, ! {"globpath", 2, 5, FEARG_2, NULL, ret_any, f_globpath}, ! {"has", 1, 2, 0, NULL, ret_number_bool, f_has}, {"has_key", 2, 2, FEARG_1, arg2_dict_string_or_nr, ret_number_bool, f_has_key}, {"haslocaldir", 0, 2, FEARG_1, arg2_number, ret_number, f_haslocaldir}, ! {"hasmapto", 1, 3, FEARG_1, NULL, ret_number_bool, f_hasmapto}, {"highlightID", 1, 1, FEARG_1, NULL, // obsolete ret_number, f_hlID}, --- 1342,1362 ---- ret_number, f_getwinposx}, {"getwinposy", 0, 0, 0, NULL, ret_number, f_getwinposy}, ! {"getwinvar", 2, 3, FEARG_1, arg3_number_string_any, ret_any, f_getwinvar}, ! {"glob", 1, 4, FEARG_1, arg4_glob, ret_any, f_glob}, {"glob2regpat", 1, 1, FEARG_1, arg1_string, ret_string, f_glob2regpat}, ! {"globpath", 2, 5, FEARG_2, arg5_globpath, ret_any, f_globpath}, ! {"has", 1, 2, 0, arg2_string_bool, ret_number_bool, f_has}, {"has_key", 2, 2, FEARG_1, arg2_dict_string_or_nr, ret_number_bool, f_has_key}, {"haslocaldir", 0, 2, FEARG_1, arg2_number, ret_number, f_haslocaldir}, ! {"hasmapto", 1, 3, FEARG_1, arg3_string_string_bool, ret_number_bool, f_hasmapto}, {"highlightID", 1, 1, FEARG_1, NULL, // obsolete ret_number, f_hlID}, *************** *** 1198,1204 **** ret_number_bool, f_histadd}, {"histdel", 1, 2, FEARG_1, NULL, ret_number_bool, f_histdel}, ! {"histget", 1, 2, FEARG_1, arg2_string_nr, ret_string, f_histget}, {"histnr", 1, 1, FEARG_1, arg1_string, ret_number, f_histnr}, --- 1366,1372 ---- ret_number_bool, f_histadd}, {"histdel", 1, 2, FEARG_1, NULL, ret_number_bool, f_histdel}, ! {"histget", 1, 2, FEARG_1, arg2_string_number, ret_string, f_histget}, {"histnr", 1, 1, FEARG_1, arg1_string, ret_number, f_histnr}, *************** *** 1212,1218 **** ret_string, f_iconv}, {"indent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_indent}, ! {"index", 2, 4, FEARG_1, NULL, ret_number, f_index}, {"input", 1, 3, FEARG_1, arg3_string, ret_string, f_input}, --- 1380,1386 ---- ret_string, f_iconv}, {"indent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_indent}, ! {"index", 2, 4, FEARG_1, arg4_index, ret_number, f_index}, {"input", 1, 3, FEARG_1, arg3_string, ret_string, f_input}, *************** *** 1246,1260 **** ret_channel, JOB_FUNC(f_job_getchannel)}, {"job_info", 0, 1, FEARG_1, arg1_job, ret_job_info, JOB_FUNC(f_job_info)}, ! {"job_setoptions", 2, 2, FEARG_1, NULL, ret_void, JOB_FUNC(f_job_setoptions)}, {"job_start", 1, 2, FEARG_1, NULL, ret_job, JOB_FUNC(f_job_start)}, {"job_status", 1, 1, FEARG_1, arg1_job, ret_string, JOB_FUNC(f_job_status)}, ! {"job_stop", 1, 2, FEARG_1, NULL, ret_number_bool, JOB_FUNC(f_job_stop)}, ! {"join", 1, 2, FEARG_1, NULL, ret_string, f_join}, {"js_decode", 1, 1, FEARG_1, arg1_string, ret_any, f_js_decode}, --- 1414,1428 ---- ret_channel, JOB_FUNC(f_job_getchannel)}, {"job_info", 0, 1, FEARG_1, arg1_job, ret_job_info, JOB_FUNC(f_job_info)}, ! {"job_setoptions", 2, 2, FEARG_1, arg2_job_dict, ret_void, JOB_FUNC(f_job_setoptions)}, {"job_start", 1, 2, FEARG_1, NULL, ret_job, JOB_FUNC(f_job_start)}, {"job_status", 1, 1, FEARG_1, arg1_job, ret_string, JOB_FUNC(f_job_status)}, ! {"job_stop", 1, 2, FEARG_1, arg2_job_string_or_number, ret_number_bool, JOB_FUNC(f_job_stop)}, ! {"join", 1, 2, FEARG_1, arg2_list_any_string, ret_string, f_join}, {"js_decode", 1, 1, FEARG_1, arg1_string, ret_any, f_js_decode}, *************** *** 1274,1286 **** ret_string, f_libcall}, {"libcallnr", 3, 3, FEARG_3, NULL, ret_number, f_libcallnr}, ! {"line", 1, 2, FEARG_1, arg2_string_nr, ret_number, f_line}, {"line2byte", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_line2byte}, {"lispindent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_lispindent}, ! {"list2str", 1, 2, FEARG_1, NULL, ret_string, f_list2str}, {"listener_add", 1, 2, FEARG_2, NULL, ret_number, f_listener_add}, --- 1442,1454 ---- ret_string, f_libcall}, {"libcallnr", 3, 3, FEARG_3, NULL, ret_number, f_libcallnr}, ! {"line", 1, 2, FEARG_1, arg2_string_number, ret_number, f_line}, {"line2byte", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_line2byte}, {"lispindent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_lispindent}, ! {"list2str", 1, 2, FEARG_1, arg2_list_number_bool, ret_string, f_list2str}, {"listener_add", 1, 2, FEARG_2, NULL, ret_number, f_listener_add}, *************** *** 1304,1316 **** }, {"map", 2, 2, FEARG_1, NULL, ret_first_cont, f_map}, ! {"maparg", 1, 4, FEARG_1, NULL, ret_maparg, f_maparg}, ! {"mapcheck", 1, 3, FEARG_1, NULL, ret_string, f_mapcheck}, {"mapnew", 2, 2, FEARG_1, NULL, ret_first_cont, f_mapnew}, ! {"mapset", 3, 3, FEARG_1, NULL, ret_void, f_mapset}, {"match", 2, 4, FEARG_1, arg4_match_func, ret_any, f_match}, --- 1472,1484 ---- }, {"map", 2, 2, FEARG_1, NULL, ret_first_cont, f_map}, ! {"maparg", 1, 4, FEARG_1, arg4_maparg, ret_maparg, f_maparg}, ! {"mapcheck", 1, 3, FEARG_1, arg3_string_string_bool, ret_string, f_mapcheck}, {"mapnew", 2, 2, FEARG_1, NULL, ret_first_cont, f_mapnew}, ! {"mapset", 3, 3, FEARG_1, arg3_string_bool_dict, ret_void, f_mapset}, {"match", 2, 4, FEARG_1, arg4_match_func, ret_any, f_match}, *************** *** 1324,1332 **** ret_number_bool, f_matchdelete}, {"matchend", 2, 4, FEARG_1, arg4_match_func, ret_number, f_matchend}, ! {"matchfuzzy", 2, 3, FEARG_1, NULL, ret_list_string, f_matchfuzzy}, ! {"matchfuzzypos", 2, 3, FEARG_1, NULL, ret_list_any, f_matchfuzzypos}, {"matchlist", 2, 4, FEARG_1, arg4_match_func, ret_list_string, f_matchlist}, --- 1492,1500 ---- ret_number_bool, f_matchdelete}, {"matchend", 2, 4, FEARG_1, arg4_match_func, ret_number, f_matchend}, ! {"matchfuzzy", 2, 3, FEARG_1, arg3_list_string_dict, ret_list_string, f_matchfuzzy}, ! {"matchfuzzypos", 2, 3, FEARG_1, arg3_list_string_dict, ret_list_any, f_matchfuzzypos}, {"matchlist", 2, 4, FEARG_1, arg4_match_func, ret_list_string, f_matchlist}, *************** *** 1360,1370 **** }, {"nextnonblank", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_nextnonblank}, ! {"nr2char", 1, 2, FEARG_1, NULL, ret_string, f_nr2char}, {"or", 2, 2, FEARG_1, arg2_number, ret_number, f_or}, ! {"pathshorten", 1, 2, FEARG_1, arg2_string_nr, ret_string, f_pathshorten}, {"perleval", 1, 1, FEARG_1, arg1_string, ret_any, --- 1528,1538 ---- }, {"nextnonblank", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_nextnonblank}, ! {"nr2char", 1, 2, FEARG_1, arg2_nr_bool, ret_string, f_nr2char}, {"or", 2, 2, FEARG_1, arg2_number, ret_number, f_or}, ! {"pathshorten", 1, 2, FEARG_1, arg2_string_number, ret_string, f_pathshorten}, {"perleval", 1, 1, FEARG_1, arg1_string, ret_any, *************** *** 1430,1444 **** ret_void, JOB_FUNC(f_prompt_setinterrupt)}, {"prompt_setprompt", 2, 2, FEARG_1, arg2_string_or_nr_string, ret_void, JOB_FUNC(f_prompt_setprompt)}, ! {"prop_add", 3, 3, FEARG_1, NULL, ret_void, PROP_FUNC(f_prop_add)}, ! {"prop_clear", 1, 3, FEARG_1, NULL, ret_void, PROP_FUNC(f_prop_clear)}, {"prop_find", 1, 2, FEARG_1, arg2_dict_string, ret_dict_any, PROP_FUNC(f_prop_find)}, {"prop_list", 1, 2, FEARG_1, arg2_nr_dict_any, ret_list_dict_any, PROP_FUNC(f_prop_list)}, ! {"prop_remove", 1, 3, FEARG_1, NULL, ret_number, PROP_FUNC(f_prop_remove)}, {"prop_type_add", 2, 2, FEARG_1, arg2_string_dict, ret_void, PROP_FUNC(f_prop_type_add)}, --- 1598,1612 ---- ret_void, JOB_FUNC(f_prompt_setinterrupt)}, {"prompt_setprompt", 2, 2, FEARG_1, arg2_string_or_nr_string, ret_void, JOB_FUNC(f_prompt_setprompt)}, ! {"prop_add", 3, 3, FEARG_1, arg3_number_number_dict, ret_void, PROP_FUNC(f_prop_add)}, ! {"prop_clear", 1, 3, FEARG_1, arg3_number_number_dict, ret_void, PROP_FUNC(f_prop_clear)}, {"prop_find", 1, 2, FEARG_1, arg2_dict_string, ret_dict_any, PROP_FUNC(f_prop_find)}, {"prop_list", 1, 2, FEARG_1, arg2_nr_dict_any, ret_list_dict_any, PROP_FUNC(f_prop_list)}, ! {"prop_remove", 1, 3, FEARG_1, arg3_dict_number_number, ret_number, PROP_FUNC(f_prop_remove)}, {"prop_type_add", 2, 2, FEARG_1, arg2_string_dict, ret_void, PROP_FUNC(f_prop_type_add)}, *************** *** 1478,1484 **** NULL #endif }, ! {"rand", 0, 1, FEARG_1, arg1_list_nr, ret_number, f_rand}, {"range", 1, 3, FEARG_1, arg3_number, ret_list_number, f_range}, --- 1646,1652 ---- NULL #endif }, ! {"rand", 0, 1, FEARG_1, arg1_list_number, ret_number, f_rand}, {"range", 1, 3, FEARG_1, arg3_number, ret_list_number, f_range}, *************** *** 1498,1520 **** ret_string, f_reg_recording}, {"reltime", 0, 2, FEARG_1, arg2_list_nr, ret_list_any, f_reltime}, ! {"reltimefloat", 1, 1, FEARG_1, arg1_list_nr, ret_float, FLOAT_FUNC(f_reltimefloat)}, ! {"reltimestr", 1, 1, FEARG_1, arg1_list_nr, ret_string, f_reltimestr}, ! {"remote_expr", 2, 4, FEARG_1, NULL, ret_string, f_remote_expr}, {"remote_foreground", 1, 1, FEARG_1, arg1_string, ret_string, f_remote_foreground}, {"remote_peek", 1, 2, FEARG_1, arg2_string, ret_number, f_remote_peek}, ! {"remote_read", 1, 2, FEARG_1, arg2_string_nr, ret_string, f_remote_read}, ! {"remote_send", 2, 3, FEARG_1, NULL, ret_string, f_remote_send}, {"remote_startserver", 1, 1, FEARG_1, arg1_string, ret_void, f_remote_startserver}, ! {"remove", 2, 3, FEARG_1, NULL, ret_remove, f_remove}, {"rename", 2, 2, FEARG_1, arg2_string, ret_number_bool, f_rename}, --- 1666,1688 ---- ret_string, f_reg_recording}, {"reltime", 0, 2, FEARG_1, arg2_list_nr, ret_list_any, f_reltime}, ! {"reltimefloat", 1, 1, FEARG_1, arg1_list_number, ret_float, FLOAT_FUNC(f_reltimefloat)}, ! {"reltimestr", 1, 1, FEARG_1, arg1_list_number, ret_string, f_reltimestr}, ! {"remote_expr", 2, 4, FEARG_1, arg4_remote_expr, ret_string, f_remote_expr}, {"remote_foreground", 1, 1, FEARG_1, arg1_string, ret_string, f_remote_foreground}, {"remote_peek", 1, 2, FEARG_1, arg2_string, ret_number, f_remote_peek}, ! {"remote_read", 1, 2, FEARG_1, arg2_string_number, ret_string, f_remote_read}, ! {"remote_send", 2, 3, FEARG_1, arg3_string, ret_string, f_remote_send}, {"remote_startserver", 1, 1, FEARG_1, arg1_string, ret_void, f_remote_startserver}, ! {"remove", 2, 3, FEARG_1, arg3_remove, ret_remove, f_remove}, {"rename", 2, 2, FEARG_1, arg2_string, ret_number_bool, f_rename}, *************** *** 1552,1558 **** ret_number, f_search}, {"searchcount", 0, 1, FEARG_1, arg1_dict_any, ret_dict_any, f_searchcount}, ! {"searchdecl", 1, 3, FEARG_1, NULL, ret_number_bool, f_searchdecl}, {"searchpair", 3, 7, 0, NULL, ret_number, f_searchpair}, --- 1720,1726 ---- ret_number, f_search}, {"searchcount", 0, 1, FEARG_1, arg1_dict_any, ret_dict_any, f_searchcount}, ! {"searchdecl", 1, 3, FEARG_1, arg3_string_bool_bool, ret_number_bool, f_searchdecl}, {"searchpair", 3, 7, 0, NULL, ret_number, f_searchpair}, *************** *** 1570,1582 **** ret_void, f_setbufvar}, {"setcellwidths", 1, 1, FEARG_1, arg1_list_any, ret_void, f_setcellwidths}, ! {"setcharpos", 2, 2, FEARG_2, NULL, ret_number_bool, f_setcharpos}, {"setcharsearch", 1, 1, FEARG_1, arg1_dict_any, ret_void, f_setcharsearch}, {"setcmdpos", 1, 1, FEARG_1, arg1_number, ret_number_bool, f_setcmdpos}, ! {"setcursorcharpos", 1, 3, FEARG_1, NULL, ret_number_bool, f_setcursorcharpos}, {"setdigraph", 2, 2, FEARG_1, arg2_string_number, ret_bool, f_setdigraph}, --- 1738,1750 ---- ret_void, f_setbufvar}, {"setcellwidths", 1, 1, FEARG_1, arg1_list_any, ret_void, f_setcellwidths}, ! {"setcharpos", 2, 2, FEARG_2, arg2_string_list_nr, ret_number_bool, f_setcharpos}, {"setcharsearch", 1, 1, FEARG_1, arg1_dict_any, ret_void, f_setcharsearch}, {"setcmdpos", 1, 1, FEARG_1, arg1_number, ret_number_bool, f_setcmdpos}, ! {"setcursorcharpos", 1, 3, FEARG_1, arg3_cursor, ret_number_bool, f_setcursorcharpos}, {"setdigraph", 2, 2, FEARG_1, arg2_string_number, ret_bool, f_setdigraph}, *************** *** 1588,1610 **** ret_number_bool, f_setfperm}, {"setline", 2, 2, FEARG_2, arg2_setline, ret_number_bool, f_setline}, ! {"setloclist", 2, 4, FEARG_2, NULL, ret_number_bool, f_setloclist}, ! {"setmatches", 1, 2, FEARG_1, NULL, ret_number_bool, f_setmatches}, ! {"setpos", 2, 2, FEARG_2, NULL, ret_number_bool, f_setpos}, ! {"setqflist", 1, 3, FEARG_1, NULL, ret_number_bool, f_setqflist}, {"setreg", 2, 3, FEARG_2, NULL, ret_number_bool, f_setreg}, ! {"settabvar", 3, 3, FEARG_3, NULL, ret_void, f_settabvar}, ! {"settabwinvar", 4, 4, FEARG_4, NULL, ret_void, f_settabwinvar}, ! {"settagstack", 2, 3, FEARG_2, NULL, ret_number_bool, f_settagstack}, ! {"setwinvar", 3, 3, FEARG_3, NULL, ret_void, f_setwinvar}, {"sha256", 1, 1, FEARG_1, arg1_string, ret_string, --- 1756,1778 ---- ret_number_bool, f_setfperm}, {"setline", 2, 2, FEARG_2, arg2_setline, ret_number_bool, f_setline}, ! {"setloclist", 2, 4, FEARG_2, arg4_setloclist, ret_number_bool, f_setloclist}, ! {"setmatches", 1, 2, FEARG_1, arg2_list_any_number, ret_number_bool, f_setmatches}, ! {"setpos", 2, 2, FEARG_2, arg2_string_list_nr, ret_number_bool, f_setpos}, ! {"setqflist", 1, 3, FEARG_1, arg3_setqflist, ret_number_bool, f_setqflist}, {"setreg", 2, 3, FEARG_2, NULL, ret_number_bool, f_setreg}, ! {"settabvar", 3, 3, FEARG_3, arg3_number_string_any, ret_void, f_settabvar}, ! {"settabwinvar", 4, 4, FEARG_4, arg4_number_number_string_any, ret_void, f_settabwinvar}, ! {"settagstack", 2, 3, FEARG_2, arg2_settagstack, ret_number_bool, f_settagstack}, ! {"setwinvar", 3, 3, FEARG_3, arg3_number_string_any, ret_void, f_setwinvar}, {"sha256", 1, 1, FEARG_1, arg1_string, ret_string, *************** *** 1614,1620 **** NULL #endif }, ! {"shellescape", 1, 2, FEARG_1, NULL, ret_string, f_shellescape}, {"shiftwidth", 0, 1, FEARG_1, arg1_number, ret_number, f_shiftwidth}, --- 1782,1788 ---- NULL #endif }, ! {"shellescape", 1, 2, FEARG_1, arg2_string_bool, ret_string, f_shellescape}, {"shiftwidth", 0, 1, FEARG_1, arg1_number, ret_number, f_shiftwidth}, *************** *** 1622,1628 **** ret_any, SIGN_FUNC(f_sign_define)}, {"sign_getdefined", 0, 1, FEARG_1, arg1_string, ret_list_dict_any, SIGN_FUNC(f_sign_getdefined)}, ! {"sign_getplaced", 0, 2, FEARG_1, NULL, ret_list_dict_any, SIGN_FUNC(f_sign_getplaced)}, {"sign_jump", 3, 3, FEARG_1, NULL, ret_number, SIGN_FUNC(f_sign_jump)}, --- 1790,1796 ---- ret_any, SIGN_FUNC(f_sign_define)}, {"sign_getdefined", 0, 1, FEARG_1, arg1_string, ret_list_dict_any, SIGN_FUNC(f_sign_getdefined)}, ! {"sign_getplaced", 0, 2, FEARG_1, arg2_sign_getplaced, ret_list_dict_any, SIGN_FUNC(f_sign_getplaced)}, {"sign_jump", 3, 3, FEARG_1, NULL, ret_number, SIGN_FUNC(f_sign_jump)}, *************** *** 1642,1648 **** ret_float, FLOAT_FUNC(f_sin)}, {"sinh", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sinh)}, ! {"slice", 2, 3, FEARG_1, NULL, ret_first_arg, f_slice}, {"sort", 1, 3, FEARG_1, NULL, ret_first_arg, f_sort}, --- 1810,1816 ---- ret_float, FLOAT_FUNC(f_sin)}, {"sinh", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sinh)}, ! {"slice", 2, 3, FEARG_1, arg3_slice, ret_first_arg, f_slice}, {"sort", 1, 3, FEARG_1, NULL, ret_first_arg, f_sort}, *************** *** 1658,1666 **** ret_string, f_soundfold}, {"spellbadword", 0, 1, FEARG_1, arg1_string, ret_list_string, f_spellbadword}, ! {"spellsuggest", 1, 3, FEARG_1, NULL, ret_list_string, f_spellsuggest}, ! {"split", 1, 3, FEARG_1, NULL, ret_list_string, f_split}, {"sqrt", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sqrt)}, --- 1826,1834 ---- ret_string, f_soundfold}, {"spellbadword", 0, 1, FEARG_1, arg1_string, ret_list_string, f_spellbadword}, ! {"spellsuggest", 1, 3, FEARG_1, arg3_string_nr_bool, ret_list_string, f_spellsuggest}, ! {"split", 1, 3, FEARG_1, arg3_string_string_bool, ret_list_string, f_split}, {"sqrt", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sqrt)}, *************** *** 1676,1688 **** ret_number, f_str2nr}, {"strcharlen", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_strcharlen}, ! {"strcharpart", 2, 4, FEARG_1, NULL, ret_string, f_strcharpart}, {"strchars", 1, 2, FEARG_1, arg2_string_bool, ret_number, f_strchars}, ! {"strdisplaywidth", 1, 2, FEARG_1, arg2_string_nr, ret_number, f_strdisplaywidth}, ! {"strftime", 1, 2, FEARG_1, arg2_string_nr, ret_string, #ifdef HAVE_STRFTIME f_strftime --- 1844,1856 ---- ret_number, f_str2nr}, {"strcharlen", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_strcharlen}, ! {"strcharpart", 2, 4, FEARG_1, arg4_strpart, ret_string, f_strcharpart}, {"strchars", 1, 2, FEARG_1, arg2_string_bool, ret_number, f_strchars}, ! {"strdisplaywidth", 1, 2, FEARG_1, arg2_string_number, ret_number, f_strdisplaywidth}, ! {"strftime", 1, 2, FEARG_1, arg2_string_number, ret_string, #ifdef HAVE_STRFTIME f_strftime *************** *** 1690,1696 **** NULL #endif }, ! {"strgetchar", 2, 2, FEARG_1, arg2_string_nr, ret_number, f_strgetchar}, {"stridx", 2, 3, FEARG_1, arg3_string_string_nr, ret_number, f_stridx}, --- 1858,1864 ---- NULL #endif }, ! {"strgetchar", 2, 2, FEARG_1, arg2_string_number, ret_number, f_strgetchar}, {"stridx", 2, 3, FEARG_1, arg3_string_string_nr, ret_number, f_stridx}, *************** *** 1698,1704 **** ret_string, f_string}, {"strlen", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_strlen}, ! {"strpart", 2, 4, FEARG_1, NULL, ret_string, f_strpart}, {"strptime", 2, 2, FEARG_1, arg2_string, ret_number, --- 1866,1872 ---- ret_string, f_string}, {"strlen", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_strlen}, ! {"strpart", 2, 4, FEARG_1, arg4_strpart, ret_string, f_strpart}, {"strptime", 2, 2, FEARG_1, arg2_string, ret_number, *************** *** 1714,1720 **** ret_string, f_strtrans}, {"strwidth", 1, 1, FEARG_1, arg1_string, ret_number, f_strwidth}, ! {"submatch", 1, 2, FEARG_1, NULL, ret_string, f_submatch}, {"substitute", 4, 4, FEARG_1, NULL, ret_string, f_substitute}, --- 1882,1888 ---- ret_string, f_strtrans}, {"strwidth", 1, 1, FEARG_1, arg1_string, ret_number, f_strwidth}, ! {"submatch", 1, 2, FEARG_1, arg2_nr_bool, ret_string, f_submatch}, {"substitute", 4, 4, FEARG_1, NULL, ret_string, f_substitute}, *************** *** 1722,1728 **** ret_dict_any, f_swapinfo}, {"swapname", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, f_swapname}, ! {"synID", 3, 3, 0, NULL, ret_number, f_synID}, {"synIDattr", 2, 3, FEARG_1, NULL, ret_string, f_synIDattr}, --- 1890,1896 ---- ret_dict_any, f_swapinfo}, {"swapname", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, f_swapname}, ! {"synID", 3, 3, 0, arg3_string_or_nr_nr_bool, ret_number, f_synID}, {"synIDattr", 2, 3, FEARG_1, NULL, ret_string, f_synIDattr}, *************** *** 1784,1790 **** ret_string, TERM_FUNC(f_term_getstatus)}, {"term_gettitle", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, TERM_FUNC(f_term_gettitle)}, ! {"term_gettty", 1, 2, FEARG_1, NULL, ret_string, TERM_FUNC(f_term_gettty)}, {"term_list", 0, 0, 0, NULL, ret_list_number, TERM_FUNC(f_term_list)}, --- 1952,1958 ---- ret_string, TERM_FUNC(f_term_getstatus)}, {"term_gettitle", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, TERM_FUNC(f_term_gettitle)}, ! {"term_gettty", 1, 2, FEARG_1, arg2_string_or_nr_bool, ret_string, TERM_FUNC(f_term_gettty)}, {"term_list", 0, 0, 0, NULL, ret_list_number, TERM_FUNC(f_term_list)}, *************** *** 1792,1798 **** ret_list_dict_any, TERM_FUNC(f_term_scrape)}, {"term_sendkeys", 2, 2, FEARG_1, arg2_string_or_nr_string, ret_void, TERM_FUNC(f_term_sendkeys)}, ! {"term_setansicolors", 2, 2, FEARG_1, NULL, ret_void, #if defined(FEAT_TERMINAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) f_term_setansicolors --- 1960,1966 ---- ret_list_dict_any, TERM_FUNC(f_term_scrape)}, {"term_sendkeys", 2, 2, FEARG_1, arg2_string_or_nr_string, ret_void, TERM_FUNC(f_term_sendkeys)}, ! {"term_setansicolors", 2, 2, FEARG_1, arg2_term_setansicolors, ret_void, #if defined(FEAT_TERMINAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) f_term_setansicolors *************** *** 1828,1834 **** ret_number, f_test_getvalue}, {"test_gui_drop_files", 4, 4, 0, NULL, ret_void, f_test_gui_drop_files}, ! {"test_gui_mouse_event", 5, 5, 0, NULL, ret_void, f_test_gui_mouse_event}, {"test_ignore_error", 1, 1, FEARG_1, arg1_string, ret_void, f_test_ignore_error}, --- 1996,2002 ---- ret_number, f_test_getvalue}, {"test_gui_drop_files", 4, 4, 0, NULL, ret_void, f_test_gui_drop_files}, ! {"test_gui_mouse_event", 5, 5, 0, arg5_number, ret_void, f_test_gui_mouse_event}, {"test_ignore_error", 1, 1, FEARG_1, arg1_string, ret_void, f_test_ignore_error}, *************** *** 1850,1856 **** ret_string, f_test_null_string}, {"test_option_not_set", 1, 1, FEARG_1, arg1_string, ret_void, f_test_option_not_set}, ! {"test_override", 2, 2, FEARG_2, arg2_string_nr, ret_void, f_test_override}, {"test_refcount", 1, 1, FEARG_1, NULL, ret_number, f_test_refcount}, --- 2018,2024 ---- ret_string, f_test_null_string}, {"test_option_not_set", 1, 1, FEARG_1, arg1_string, ret_void, f_test_option_not_set}, ! {"test_override", 2, 2, FEARG_2, arg2_string_number, ret_void, f_test_override}, {"test_refcount", 1, 1, FEARG_1, NULL, ret_number, f_test_refcount}, *************** *** 1874,1880 **** ret_void, f_test_void}, {"timer_info", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, TIMER_FUNC(f_timer_info)}, ! {"timer_pause", 2, 2, FEARG_1, NULL, ret_void, TIMER_FUNC(f_timer_pause)}, {"timer_start", 2, 3, FEARG_1, NULL, ret_number, TIMER_FUNC(f_timer_start)}, --- 2042,2048 ---- ret_void, f_test_void}, {"timer_info", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, TIMER_FUNC(f_timer_info)}, ! {"timer_pause", 2, 2, FEARG_1, arg2_nr_bool, ret_void, TIMER_FUNC(f_timer_pause)}, {"timer_start", 2, 3, FEARG_1, NULL, ret_number, TIMER_FUNC(f_timer_start)}, *************** *** 1926,1932 **** ret_number, f_win_id2win}, {"win_screenpos", 1, 1, FEARG_1, arg1_number, ret_list_number, f_win_screenpos}, ! {"win_splitmove", 2, 3, FEARG_1, NULL, ret_number_bool, f_win_splitmove}, {"winbufnr", 1, 1, FEARG_1, arg1_number, ret_number, f_winbufnr}, --- 2094,2100 ---- ret_number, f_win_id2win}, {"win_screenpos", 1, 1, FEARG_1, arg1_number, ret_list_number, f_win_screenpos}, ! {"win_splitmove", 2, 3, FEARG_1, arg3_number_number_dict, ret_number_bool, f_win_splitmove}, {"winbufnr", 1, 1, FEARG_1, arg1_number, ret_number, f_winbufnr}, *************** *** 2494,2501 **** { if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_bool_arg(argvars, 1) == FAIL))) return; if (has_mbyte) --- 2662,2668 ---- { if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; if (has_mbyte) *************** *** 2679,2684 **** --- 2846,2860 ---- long coladd = 0; int set_curswant = TRUE; + if (in_vim9script() + && ((argvars[0].v_type != VAR_NUMBER + && argvars[0].v_type != VAR_STRING + && argvars[0].v_type != VAR_LIST + && check_for_number_arg(argvars, 0) == FAIL) + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + rettv->vval.v_number = -1; if (argvars[0].v_type == VAR_LIST) { *************** *** 2785,2790 **** --- 2961,2970 ---- varnumber_T noref = 0; int copyID; + if (in_vim9script() + && (check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + if (argvars[1].v_type != VAR_UNKNOWN) noref = tv_get_bool_chk(&argvars[1], NULL); if (noref < 0 || noref > 1) *************** *** 3234,3240 **** --- 3414,3429 ---- char_u *result; #ifdef BACKSLASH_IN_FILENAME char_u *p_csl_save = p_csl; + #endif + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + + #ifdef BACKSLASH_IN_FILENAME // avoid using 'completeslash' here p_csl = empty_option; #endif *************** *** 4132,4137 **** --- 4321,4333 ---- int return_list = FALSE; int error = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + if (argvars[0].v_type != VAR_UNKNOWN) { strregname = tv_get_string_chk(&argvars[0]); *************** *** 5414,5419 **** --- 5610,5620 ---- {NULL, 0} }; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + name = tv_get_string(&argvars[0]); for (i = 0; has_list[i].name != NULL; ++i) if (STRICMP(name, has_list[i].name) == 0) *************** *** 5702,5707 **** --- 5903,5915 ---- char_u buf[NUMBUFLEN]; int abbr = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + name = tv_get_string(&argvars[0]); if (argvars[1].v_type == VAR_UNKNOWN) mode = (char_u *)"nvo"; *************** *** 5763,5768 **** --- 5971,5986 ---- int error = FALSE; rettv->vval.v_number = -1; + + if (in_vim9script() + && ((argvars[0].v_type != VAR_LIST + && argvars[0].v_type != VAR_BLOB + && check_for_list_arg(argvars, 0) == FAIL) + || check_for_opt_number_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 3) == FAIL))) + return; + if (argvars[0].v_type == VAR_BLOB) { typval_T tv; *************** *** 6180,6187 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; if (argvars[1].v_type != VAR_UNKNOWN) --- 6398,6404 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; if (argvars[1].v_type != VAR_UNKNOWN) *************** *** 6254,6259 **** --- 6471,6485 ---- static void f_maparg(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && (check_for_opt_bool_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 3) == FAIL))))) + return; + get_maparg(argvars, rettv, TRUE); } *************** *** 6263,6268 **** --- 6489,6501 ---- static void f_mapcheck(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + get_maparg(argvars, rettv, FALSE); } *************** *** 6331,6341 **** && ((argvars[0].v_type != VAR_STRING && argvars[0].v_type != VAR_LIST && check_for_string_arg(argvars, 0) == FAIL) ! || (check_for_string_arg(argvars, 1) == FAIL) || (argvars[2].v_type != VAR_UNKNOWN ! && (check_for_number_arg(argvars, 2) == FAIL ! || (argvars[3].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 3) == FAIL))))) goto theend; if (argvars[0].v_type == VAR_LIST) --- 6564,6573 ---- && ((argvars[0].v_type != VAR_STRING && argvars[0].v_type != VAR_LIST && check_for_string_arg(argvars, 0) == FAIL) ! || check_for_string_arg(argvars, 1) == FAIL ! || check_for_opt_number_arg(argvars, 2) == FAIL || (argvars[2].v_type != VAR_UNKNOWN ! && check_for_opt_number_arg(argvars, 3) == FAIL))) goto theend; if (argvars[0].v_type == VAR_LIST) *************** *** 6716,6721 **** --- 6948,6958 ---- { char_u buf[NUMBUFLEN]; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + if (has_mbyte) { int utf8 = 0; *************** *** 7690,7695 **** --- 7927,7939 ---- rettv->vval.v_number = 1; // default: FAIL + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { *************** *** 8038,8043 **** --- 8282,8292 ---- rettv->vval.v_number = -1; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_list_arg(argvars, 1) == FAIL)) + return; + name = tv_get_string_chk(argvars); if (name != NULL) { *************** *** 8401,8406 **** --- 8650,8661 ---- rettv->vval.v_number = -1; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_dict_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL)) + return; + // first argument: window number or id wp = find_win_by_nr_or_id(&argvars[0]); if (wp == NULL) *************** *** 8467,8474 **** static void f_shellescape(typval_T *argvars, typval_T *rettv) { ! int do_special = non_zero_arg(&argvars[1]); rettv->vval.v_string = vim_strsave_shellescape( tv_get_string(&argvars[0]), do_special, do_special); rettv->v_type = VAR_STRING; --- 8722,8735 ---- static void f_shellescape(typval_T *argvars, typval_T *rettv) { ! int do_special; ! ! if (in_vim9script() ! && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_bool_arg(argvars, 1) == FAIL)) ! return; + do_special = non_zero_arg(&argvars[1]); rettv->vval.v_string = vim_strsave_shellescape( tv_get_string(&argvars[0]), do_special, do_special); rettv->v_type = VAR_STRING; *************** *** 8610,8615 **** --- 8871,8883 ---- int need_capital = FALSE; int wo_spell_save = curwin->w_p_spell; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_number_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + if (!curwin->w_p_spell) { did_set_spelllang(curwin); *************** *** 8688,8693 **** --- 8956,8968 ---- int keepempty = FALSE; int typeerr = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 2) == FAIL))) + return; + // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; p_cpo = empty_option; *************** *** 8758,8763 **** --- 9033,9043 ---- int no; int retList = 0; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + no = (int)tv_get_number_chk(&argvars[0], &error); if (error) return; *************** *** 8852,8857 **** --- 9132,9143 ---- int trans; int transerr = FALSE; + if (in_vim9script() + && (check_for_string_or_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_bool_arg(argvars, 2) == FAIL)) + return; + lnum = tv_get_lnum(argvars); // -1 on type error col = (linenr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error trans = (int)tv_get_bool_chk(&argvars[2], &transerr); *************** *** 8996,9004 **** rettv_list_set(rettv, NULL); if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_number_arg(argvars, 1) == FAIL)) return; --- 9282,9288 ---- rettv_list_set(rettv, NULL); if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; *************** *** 9059,9067 **** rettv_list_set(rettv, NULL); if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_number_arg(argvars, 1) == FAIL)) return; --- 9343,9349 ---- rettv_list_set(rettv, NULL); if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; *** ../vim-8.2.3187/src/evalvars.c 2021-07-19 21:45:03.832786190 +0200 --- src/evalvars.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 4039,4044 **** --- 4039,4049 ---- rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + varname = tv_get_string_chk(&argvars[1]); tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); if (tp != NULL && varname != NULL) *************** *** 4073,4078 **** --- 4078,4089 ---- void f_gettabwinvar(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_string_arg(argvars, 2) == FAIL)) + return; + getwinvar(argvars, rettv, 1); } *************** *** 4082,4087 **** --- 4093,4103 ---- void f_getwinvar(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + getwinvar(argvars, rettv, 0); } *************** *** 4165,4170 **** --- 4181,4191 ---- if (check_secure()) return; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); varname = tv_get_string_chk(&argvars[1]); varp = &argvars[2]; *************** *** 4195,4200 **** --- 4216,4227 ---- void f_settabwinvar(typval_T *argvars, typval_T *rettv UNUSED) { + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_string_arg(argvars, 2) == FAIL)) + return; + setwinvar(argvars, 1); } *************** *** 4204,4209 **** --- 4231,4241 ---- void f_setwinvar(typval_T *argvars, typval_T *rettv UNUSED) { + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL)) + return; + setwinvar(argvars, 0); } *** ../vim-8.2.3187/src/evalwindow.c 2021-07-15 12:48:08.807766847 +0200 --- src/evalwindow.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 655,662 **** if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_string_arg(argvars, 1) == FAIL))) return; tp = find_tabpage((int)tv_get_number(&argvars[0])); --- 655,661 ---- if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ! || check_for_opt_string_arg(argvars, 1) == FAIL)) return; tp = find_tabpage((int)tv_get_number(&argvars[0])); *************** *** 834,839 **** --- 833,844 ---- win_T *targetwin; int flags = 0, size = 0; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + wp = find_win_by_nr_or_id(&argvars[0]); targetwin = find_win_by_nr_or_id(&argvars[1]); *** ../vim-8.2.3187/src/filepath.c 2021-07-15 12:48:08.807766847 +0200 --- src/filepath.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 1254,1259 **** --- 1254,1268 ---- expand_T xpc; int error = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && (check_for_opt_bool_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 3) == FAIL))))) + return; + // When the optional second argument is non-zero, don't remove matches // for 'wildignore' and don't put matches for 'suffixes' at the end. rettv->v_type = VAR_STRING; *************** *** 1318,1328 **** { int flags = WILD_IGNORE_COMPLETESLASH; char_u buf1[NUMBUFLEN]; ! char_u *file = tv_get_string_buf_chk(&argvars[1], buf1); int error = FALSE; garray_T ga; int i; // When the optional second argument is non-zero, don't remove matches // for 'wildignore' and don't put matches for 'suffixes' at the end. rettv->v_type = VAR_STRING; --- 1327,1349 ---- { int flags = WILD_IGNORE_COMPLETESLASH; char_u buf1[NUMBUFLEN]; ! char_u *file; int error = FALSE; garray_T ga; int i; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_bool_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && (check_for_opt_bool_arg(argvars, 3) == FAIL + || (argvars[3].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 4) == FAIL))))) + return; + + file = tv_get_string_buf_chk(&argvars[1], buf1); + // When the optional second argument is non-zero, don't remove matches // for 'wildignore' and don't put matches for 'suffixes' at the end. rettv->v_type = VAR_STRING; *************** *** 1449,1456 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; if (argvars[1].v_type != VAR_UNKNOWN) --- 1470,1476 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; if (argvars[1].v_type != VAR_UNKNOWN) *************** *** 2423,2432 **** int error = FALSE; if (in_vim9script() ! && (check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL || check_for_string_arg(argvars, 3) == FAIL)) return; save = (int)tv_get_number_chk(&argvars[0], &error); title = tv_get_string_chk(&argvars[1]); initdir = tv_get_string_buf_chk(&argvars[2], buf); --- 2443,2454 ---- int error = FALSE; if (in_vim9script() ! && (check_for_bool_arg(argvars, 0) == FAIL ! || check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL || check_for_string_arg(argvars, 3) == FAIL)) return; + save = (int)tv_get_number_chk(&argvars[0], &error); title = tv_get_string_chk(&argvars[1]); initdir = tv_get_string_buf_chk(&argvars[2], buf); *** ../vim-8.2.3187/src/globals.h 2021-07-19 20:07:16.701295618 +0200 --- src/globals.h 2021-07-20 17:46:37.603626912 +0200 *************** *** 1700,1709 **** EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); EXTERN char e_stringreq[] INIT(= N_("E928: String required")); EXTERN char e_numberreq[] INIT(= N_("E889: Number required")); ! EXTERN char e_boolreq[] INIT(= N_("E839: Number required")); EXTERN char e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required")); EXTERN char e_listidx[] INIT(= N_("E684: list index out of range: %ld")); EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %ld")); EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob")); EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); --- 1700,1710 ---- EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); EXTERN char e_stringreq[] INIT(= N_("E928: String required")); EXTERN char e_numberreq[] INIT(= N_("E889: Number required")); ! EXTERN char e_boolreq[] INIT(= N_("E839: Bool required")); EXTERN char e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required")); EXTERN char e_listidx[] INIT(= N_("E684: list index out of range: %ld")); + EXTERN char e_blobreq[] INIT(= N_("E538: Dictionary required")); EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %ld")); EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob")); EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); *************** *** 1810,1815 **** --- 1811,1818 ---- #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) EXTERN char e_alloc_color[] INIT(= N_("E254: Cannot allocate color %s")); #endif + EXTERN char e_chan_or_job_req[] INIT(= N_("E706: Channel or Job required")); + EXTERN char e_jobreq[] INIT(= N_("E693: Job required")); EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM")); EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP")); *** ../vim-8.2.3187/src/insexpand.c 2021-04-04 15:05:16.784805937 +0200 --- src/insexpand.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 2436,2441 **** --- 2436,2446 ---- int startcol; int save_textlock = textlock; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_list_arg(argvars, 1) == FAIL)) + return; + if ((State & INSERT) == 0) { emsg(_("E785: complete() can only be used in Insert mode")); *************** *** 2468,2473 **** --- 2473,2484 ---- void f_complete_add(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (argvars[0].v_type != VAR_DICT + && argvars[0].v_type != VAR_STRING + && check_for_string_arg(argvars, 0) == FAIL)) + return; + rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, FALSE); } *** ../vim-8.2.3187/src/job.c 2021-07-17 19:11:03.576709073 +0200 --- src/job.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 1726,1734 **** char_u *text; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_string_arg(argvars, 1) == FAIL)) return; --- 1726,1732 ---- char_u *text; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; *************** *** 1875,1883 **** void f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED) { ! job_T *job = get_job_arg(&argvars[0]); jobopt_T opt; if (job == NULL) return; clear_job_options(&opt); --- 1873,1887 ---- void f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED) { ! job_T *job; jobopt_T opt; + if (in_vim9script() + && (check_for_job_arg(argvars, 0) == FAIL + || check_for_dict_arg(argvars, 1) == FAIL)) + return; + + job = get_job_arg(&argvars[0]); if (job == NULL) return; clear_job_options(&opt); *************** *** 1928,1935 **** void f_job_stop(typval_T *argvars, typval_T *rettv) { ! job_T *job = get_job_arg(&argvars[0]); if (job != NULL) rettv->vval.v_number = job_stop(job, argvars, NULL); } --- 1932,1945 ---- void f_job_stop(typval_T *argvars, typval_T *rettv) { ! job_T *job; ! ! if (in_vim9script() ! && (check_for_job_arg(argvars, 0) == FAIL ! || check_for_opt_string_or_number_arg(argvars, 1) == FAIL)) ! return; + job = get_job_arg(&argvars[0]); if (job != NULL) rettv->vval.v_number = job_stop(job, argvars, NULL); } *** ../vim-8.2.3187/src/list.c 2021-07-18 22:25:23.857692660 +0200 --- src/list.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 823,828 **** --- 823,833 ---- long maxdepth; int error = FALSE; + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_opt_number_arg(argvars, 1) == FAIL)) + return; + if (argvars[0].v_type != VAR_LIST) { semsg(_(e_listarg), "flatten()"); *************** *** 1267,1272 **** --- 1272,1282 ---- garray_T ga; char_u *sep; + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL)) + return; + if (argvars[0].v_type != VAR_LIST) { emsg(_(e_listreq)); *************** *** 1470,1475 **** --- 1480,1491 ---- rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + if (argvars[0].v_type != VAR_LIST) { emsg(_(e_invarg)); *************** *** 1522,1527 **** --- 1538,1549 ---- int error = FALSE; long idx; + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL)) + return; + if ((l = argvars[0].vval.v_list) == NULL || value_check_lock(l->lv_lock, arg_errmsg, TRUE)) return; *************** *** 2489,2494 **** --- 2511,2526 ---- int ic = FALSE; int error = FALSE; + if (in_vim9script() + && ((argvars[0].v_type != VAR_STRING + && argvars[0].v_type != VAR_LIST + && argvars[0].v_type != VAR_DICT + && check_for_string_arg(argvars, 0) == FAIL) + || check_for_opt_bool_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_number_arg(argvars, 3) == FAIL))) + return; + if (argvars[2].v_type != VAR_UNKNOWN) ic = (int)tv_get_bool_chk(&argvars[2], &error); *** ../vim-8.2.3187/src/map.c 2021-06-27 22:03:28.645707721 +0200 --- src/map.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 2316,2321 **** --- 2316,2327 ---- int nowait; char_u *arg; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_bool_arg(argvars, 1) == FAIL + || check_for_dict_arg(argvars, 2) == FAIL)) + return; + which = tv_get_string_buf_chk(&argvars[0], buf); if (which == NULL) return; *** ../vim-8.2.3187/src/match.c 2021-02-22 22:13:08.443640373 +0100 --- src/match.c 2021-07-20 17:46:37.603626912 +0200 *************** *** 1045,1058 **** listitem_T *li; dict_T *d; list_T *s = NULL; ! win_T *win = get_optional_window(argvars, 1); rettv->vval.v_number = -1; if (argvars[0].v_type != VAR_LIST) { emsg(_(e_listreq)); return; } if (win == NULL) return; --- 1045,1065 ---- listitem_T *li; dict_T *d; list_T *s = NULL; ! win_T *win; rettv->vval.v_number = -1; + + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_opt_number_arg(argvars, 1) == FAIL)) + return; + if (argvars[0].v_type != VAR_LIST) { emsg(_(e_listreq)); return; } + win = get_optional_window(argvars, 1); if (win == NULL) return; *** ../vim-8.2.3187/src/proto/typval.pro 2021-07-17 19:11:03.576709073 +0200 --- src/proto/typval.pro 2021-07-20 17:46:37.603626912 +0200 *************** *** 11,20 **** --- 11,34 ---- float_T tv_get_float(typval_T *varp); int check_for_string_arg(typval_T *args, int idx); int check_for_nonempty_string_arg(typval_T *args, int idx); + int check_for_opt_string_arg(typval_T *args, int idx); int check_for_number_arg(typval_T *args, int idx); + int check_for_opt_number_arg(typval_T *args, int idx); int check_for_bool_arg(typval_T *args, int idx); + int check_for_opt_bool_arg(typval_T *args, int idx); int check_for_list_arg(typval_T *args, int idx); + int check_for_opt_list_arg(typval_T *args, int idx); int check_for_dict_arg(typval_T *args, int idx); + int check_for_opt_dict_arg(typval_T *args, int idx); + int check_for_blob_arg(typval_T *args, int idx); + int check_for_chan_or_job_arg(typval_T *args, int idx); + int check_for_job_arg(typval_T *args, int idx); + int check_for_string_or_number_arg(typval_T *args, int idx); + int check_for_buffer_arg(typval_T *args, int idx); + int check_for_lnum_arg(typval_T *args, int idx); + int check_for_opt_lnum_arg(typval_T *args, int idx); + int check_for_opt_string_or_number_arg(typval_T *args, int idx); + int check_for_string_or_blob_arg(typval_T *args, int idx); char_u *tv_get_string(typval_T *varp); char_u *tv_get_string_strict(typval_T *varp); char_u *tv_get_string_buf(typval_T *varp, char_u *buf); *** ../vim-8.2.3187/src/quickfix.c 2021-07-15 13:13:35.685833496 +0200 --- src/quickfix.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 8466,8471 **** --- 8466,8479 ---- rettv->vval.v_number = -1; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_list_arg(argvars, 1) == FAIL + || check_for_opt_string_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 3) == FAIL))) + return; + win = find_win_by_nr_or_id(&argvars[0]); if (win != NULL) set_qf_ll_list(win, &argvars[1], &argvars[2], &argvars[3], rettv); *************** *** 8477,8482 **** --- 8485,8497 ---- void f_setqflist(typval_T *argvars, typval_T *rettv) { + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_opt_string_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 2) == FAIL))) + return; + set_qf_ll_list(NULL, &argvars[0], &argvars[1], &argvars[2], rettv); } #endif *** ../vim-8.2.3187/src/search.c 2021-06-02 13:28:11.435120452 +0200 --- src/search.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 1217,1223 **** do_search( oparg_T *oap, // can be NULL int dirc, // '/' or '?' ! int search_delim, // the delimiter for the search, e.g. '%' in s%regex%replacement% char_u *pat, long count, int options, --- 1217,1224 ---- do_search( oparg_T *oap, // can be NULL int dirc, // '/' or '?' ! int search_delim, // the delimiter for the search, e.g. '%' in ! // s%regex%replacement% char_u *pat, long count, int options, *************** *** 1476,1486 **** msgbuf = trunc; } ! #ifdef FEAT_RIGHTLEFT ! // The search pattern could be shown on the right in rightleft ! // mode, but the 'ruler' and 'showcmd' area use it too, thus ! // it would be blanked out again very soon. Show it on the ! // left, but do reverse the text. if (curwin->w_p_rl && *curwin->w_p_rlc == 's') { char_u *r; --- 1477,1487 ---- msgbuf = trunc; } ! #ifdef FEAT_RIGHTLEFT ! // The search pattern could be shown on the right in ! // rightleft mode, but the 'ruler' and 'showcmd' area use ! // it too, thus it would be blanked out again very soon. ! // Show it on the left, but do reverse the text. if (curwin->w_p_rl && *curwin->w_p_rlc == 's') { char_u *r; *************** *** 1503,1509 **** vim_memset(msgbuf + pat_len, ' ', r - msgbuf); } } ! #endif msg_outtrans(msgbuf); msg_clr_eos(); msg_check(); --- 1504,1510 ---- vim_memset(msgbuf + pat_len, ' ', r - msgbuf); } } ! #endif msg_outtrans(msgbuf); msg_clr_eos(); msg_check(); *************** *** 1548,1553 **** --- 1549,1557 ---- } } + /* + * The actual search. + */ c = searchit(curwin, curbuf, &pos, NULL, dirc == '/' ? FORWARD : BACKWARD, searchstr, count, spats[0].off.end + (options & *************** *** 1557,1563 **** RE_LAST, sia); if (dircp != NULL) ! *dircp = search_delim; // restore second '/' or '?' for normal_cmd() if (!shortmess(SHM_SEARCH) && ((dirc == '/' && LT_POS(pos, curwin->w_cursor)) --- 1561,1567 ---- RE_LAST, sia); if (dircp != NULL) ! *dircp = search_delim; // restore second '/' or '?' for normal_cmd() if (!shortmess(SHM_SEARCH) && ((dirc == '/' && LT_POS(pos, curwin->w_cursor)) *************** *** 4794,4799 **** --- 4798,4809 ---- int ret; int matchseq = FALSE; + if (in_vim9script() + && (check_for_list_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL)) + return; + CLEAR_POINTER(&cb); // validate and get the arguments *** ../vim-8.2.3187/src/sign.c 2021-07-15 12:48:08.807766847 +0200 --- src/sign.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 2300,2305 **** --- 2300,2311 ---- if (rettv_list_alloc_id(rettv, aid_sign_getplaced) != OK) return; + if (in_vim9script() + && (check_for_opt_string_or_number_arg(argvars, 0) == FAIL + || (argvars[0].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 1) == FAIL))) + return; + if (argvars[0].v_type != VAR_UNKNOWN) { // get signs placed in the specified buffer *** ../vim-8.2.3187/src/strings.c 2021-07-17 19:11:03.576709073 +0200 --- src/strings.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 904,911 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_bool_arg(argvars, 1) == FAIL))) return; if (argvars[1].v_type != VAR_UNKNOWN) --- 904,910 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; if (argvars[1].v_type != VAR_UNKNOWN) *************** *** 1116,1123 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_bool_arg(argvars, 1) == FAIL))) return; if (argvars[1].v_type != VAR_UNKNOWN) --- 1115,1121 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; if (argvars[1].v_type != VAR_UNKNOWN) *************** *** 1141,1148 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; s = tv_get_string(&argvars[0]); --- 1139,1145 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; s = tv_get_string(&argvars[0]); *************** *** 1178,1183 **** --- 1175,1188 ---- int slen; int error = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 3) == FAIL))) + return; + p = tv_get_string(&argvars[0]); slen = (int)STRLEN(p); *************** *** 1261,1266 **** --- 1266,1279 ---- int slen; int error = FALSE; + if (in_vim9script() + && (check_for_string_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_opt_number_arg(argvars, 2) == FAIL + || (argvars[2].v_type != VAR_UNKNOWN + && check_for_opt_bool_arg(argvars, 3) == FAIL))) + return; + p = tv_get_string(&argvars[0]); slen = (int)STRLEN(p); *** ../vim-8.2.3187/src/terminal.c 2021-07-17 19:11:03.576709073 +0200 --- src/terminal.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 5928,5938 **** void f_term_gettty(typval_T *argvars, typval_T *rettv) { ! buf_T *buf = term_get_buf(argvars, "term_gettty()"); char_u *p = NULL; int num = 0; rettv->v_type = VAR_STRING; if (buf == NULL) return; if (argvars[1].v_type != VAR_UNKNOWN) --- 5928,5944 ---- void f_term_gettty(typval_T *argvars, typval_T *rettv) { ! buf_T *buf; char_u *p = NULL; int num = 0; + if (in_vim9script() + && (check_for_string_or_number_arg(argvars, 0) == FAIL + || check_for_opt_bool_arg(argvars, 1) == FAIL)) + return; + rettv->v_type = VAR_STRING; + buf = term_get_buf(argvars, "term_gettty()"); if (buf == NULL) return; if (argvars[1].v_type != VAR_UNKNOWN) *************** *** 6098,6106 **** term_T *term; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_string_arg(argvars, 1) == FAIL)) return; --- 6104,6110 ---- term_T *term; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; *************** *** 6175,6183 **** void f_term_setansicolors(typval_T *argvars, typval_T *rettv UNUSED) { ! buf_T *buf = term_get_buf(argvars, "term_setansicolors()"); term_T *term; if (buf == NULL) return; term = buf->b_term; --- 6179,6194 ---- void f_term_setansicolors(typval_T *argvars, typval_T *rettv UNUSED) { ! buf_T *buf; term_T *term; + if (in_vim9script() + && (check_for_opt_string_or_number_arg(argvars, 0) == FAIL + || (argvars[0].v_type != VAR_UNKNOWN + && check_for_opt_list_arg(argvars, 1) == FAIL))) + return; + + buf = term_get_buf(argvars, "term_setansicolors()"); if (buf == NULL) return; term = buf->b_term; *************** *** 6206,6214 **** char_u *api; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_string_arg(argvars, 1) == FAIL)) return; --- 6217,6223 ---- char_u *api; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; *************** *** 6236,6244 **** char_u *cmd; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_string_arg(argvars, 1) == FAIL)) return; --- 6245,6251 ---- char_u *cmd; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; *************** *** 6266,6274 **** char_u *how; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || check_for_string_arg(argvars, 1) == FAIL)) return; --- 6273,6279 ---- char_u *how; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; *************** *** 6321,6331 **** buf_T *buf; if (in_vim9script() ! && ((argvars[0].v_type != VAR_STRING ! && argvars[0].v_type != VAR_NUMBER ! && check_for_string_arg(argvars, 0) == FAIL) || ! (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; buf = term_get_buf(argvars, "term_wait()"); --- 6326,6333 ---- buf_T *buf; if (in_vim9script() ! && (check_for_string_or_number_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; buf = term_get_buf(argvars, "term_wait()"); *** ../vim-8.2.3187/src/testdir/test_blob.vim 2021-04-18 16:08:49.416235259 +0200 --- src/testdir/test_blob.vim 2021-07-20 17:46:37.607626916 +0200 *************** *** 425,448 **** let lines =<< trim END VAR b = 0zDEADBEEF - call remove(1, 0) - END - call CheckLegacyAndVim9Failure(lines, 'E896:') - - let lines =<< trim END - VAR b = 0zDEADBEEF - call remove(b, b) - END - call CheckLegacyAndVim9Failure(lines, 'E974:') - - let lines =<< trim END - VAR b = 0zDEADBEEF - call remove(b, 1, []) - END - call CheckLegacyAndVim9Failure(lines, 'E745:') - - let lines =<< trim END - VAR b = 0zDEADBEEF call remove(test_null_blob(), 1, 2) END call CheckLegacyAndVim9Failure(lines, 'E979:') --- 425,430 ---- *************** *** 504,519 **** call assert_equal(-1, index(test_null_blob(), 1)) END call CheckLegacyAndVim9Success(lines) - - let lines =<< trim END - echo index(0z11110111, 0x11, []) - END - call CheckLegacyAndVim9Failure(lines, 'E745:') - - let lines =<< trim END - call index("asdf", 0) - END - call CheckLegacyAndVim9Failure(lines, 'E897:') endfunc func Test_blob_insert() --- 486,491 ---- *** ../vim-8.2.3187/src/testdir/test_gui.vim 2021-07-03 21:37:56.330492487 +0200 --- src/testdir/test_gui.vim 2021-07-20 17:46:37.607626916 +0200 *************** *** 1093,1103 **** let &guioptions = save_guioptions " Test invalid parameters for test_gui_mouse_event() ! call assert_fails('call test_gui_mouse_event("", 1, 2, 3, 4)', 'E474:') ! call assert_fails('call test_gui_mouse_event(0, "", 2, 3, 4)', 'E474:') ! call assert_fails('call test_gui_mouse_event(0, 1, "", 3, 4)', 'E474:') ! call assert_fails('call test_gui_mouse_event(0, 1, 2, "", 4)', 'E474:') ! call assert_fails('call test_gui_mouse_event(0, 1, 2, 3, "")', 'E474:') bw! call test_override('no_query_mouse', 0) --- 1093,1103 ---- let &guioptions = save_guioptions " Test invalid parameters for test_gui_mouse_event() ! call assert_fails('call test_gui_mouse_event("", 1, 2, 3, 4)', 'E1210:') ! call assert_fails('call test_gui_mouse_event(0, "", 2, 3, 4)', 'E1210:') ! call assert_fails('call test_gui_mouse_event(0, 1, "", 3, 4)', 'E1210:') ! call assert_fails('call test_gui_mouse_event(0, 1, 2, "", 4)', 'E1210:') ! call assert_fails('call test_gui_mouse_event(0, 1, 2, 3, "")', 'E1210:') bw! call test_override('no_query_mouse', 0) *** ../vim-8.2.3187/src/testdir/test_vim9_builtin.vim 2021-07-19 10:38:45.402686087 +0200 --- src/testdir/test_vim9_builtin.vim 2021-07-20 17:46:37.607626916 +0200 *************** *** 270,287 **** def Test_browse() CheckFeature browse ! var lines =<< trim END ! browse(1, 2, 3, 4) ! END ! CheckDefExecAndScriptFailure(lines, 'E1174: String required for argument 2') ! lines =<< trim END ! browse(1, 'title', 3, 4) ! END ! CheckDefExecAndScriptFailure(lines, 'E1174: String required for argument 3') ! lines =<< trim END ! browse(1, 'title', 'dir', 4) ! END ! CheckDefExecAndScriptFailure(lines, 'E1174: String required for argument 4') enddef def Test_browsedir() --- 270,279 ---- def Test_browse() CheckFeature browse ! CheckDefAndScriptFailure2(['browse(2, "title", "dir", "file")'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1') ! CheckDefAndScriptFailure2(['browse(true, 2, "dir", "file")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') ! CheckDefAndScriptFailure2(['browse(true, "title", 3, "file")'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') ! CheckDefAndScriptFailure2(['browse(true, "title", "dir", 4)'], 'E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4') enddef def Test_browsedir() *************** *** 330,335 **** --- 322,329 ---- buf = bufnr('Xdummy', true) buf->assert_notequal(-1) exe 'bwipe! ' .. buf + CheckDefAndScriptFailure2(['bufnr([1])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['bufnr(1, 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') enddef def Test_bufwinid() *************** *** 379,400 **** def Test_ch_canread() if !has('channel') CheckFeature channel endif - CheckDefFailure(['ch_canread(10)'], 'E1013: Argument 1: type mismatch, expected channel but got number') enddef def Test_ch_close() if !has('channel') CheckFeature channel endif - CheckDefFailure(['ch_close("c")'], 'E1013: Argument 1: type mismatch, expected channel but got string') enddef def Test_ch_close_in() if !has('channel') CheckFeature channel endif - CheckDefFailure(['ch_close_in(true)'], 'E1013: Argument 1: type mismatch, expected channel but got bool') enddef def Test_ch_getjob() --- 373,425 ---- def Test_ch_canread() if !has('channel') CheckFeature channel + else + CheckDefFailure(['ch_canread(10)'], 'E1013: Argument 1: type mismatch, expected channel but got number') endif enddef def Test_ch_close() if !has('channel') CheckFeature channel + else + CheckDefFailure(['ch_close("c")'], 'E1013: Argument 1: type mismatch, expected channel but got string') endif enddef def Test_ch_close_in() if !has('channel') CheckFeature channel + else + CheckDefFailure(['ch_close_in(true)'], 'E1013: Argument 1: type mismatch, expected channel but got bool') + endif + enddef + + def Test_ch_evalexpr() + if !has('channel') + CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_evalexpr(1, "a")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1218: Channel or Job required for argument 1') + CheckDefAndScriptFailure2(['ch_evalexpr(test_null_channel(), 1, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') + endif + enddef + + def Test_ch_evalraw() + if !has('channel') + CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_evalraw(1, "")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1218: Channel or Job required for argument 1') + CheckDefAndScriptFailure2(['ch_evalraw(test_null_channel(), 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['ch_evalraw(test_null_channel(), "", [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') + endif + enddef + + def Test_ch_getbufnr() + if !has('channel') + CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_getbufnr(1, "a")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1218: Channel or Job required for argument 1') + CheckDefAndScriptFailure2(['ch_getbufnr(test_null_channel(), 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') endif enddef def Test_ch_getjob() *************** *** 410,476 **** def Test_ch_info() if !has('channel') CheckFeature channel endif - CheckDefFailure(['ch_info([1])'], 'E1013: Argument 1: type mismatch, expected channel but got list') enddef def Test_ch_logfile() if !has('channel') CheckFeature channel ! endif ! assert_fails('ch_logfile(true)', 'E1174:') ! assert_fails('ch_logfile("foo", true)', 'E1174:') ! CheckDefAndScriptFailure2(['ch_logfile(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['ch_logfile("a", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2') enddef def Test_ch_open() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_open({"a": 10}, "a")'], 'E1013: Argument 1: type mismatch, expected string but got dict', 'E1174: String required for argument 1') - CheckDefAndScriptFailure2(['ch_open("a", [1])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') enddef def Test_ch_read() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_read(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') - CheckDefAndScriptFailure2(['ch_read(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') enddef def Test_ch_readblob() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_readblob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') - CheckDefAndScriptFailure2(['ch_readblob(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') enddef def Test_ch_readraw() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_readraw(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') - CheckDefAndScriptFailure2(['ch_readraw(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') enddef def Test_ch_setoptions() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_setoptions(1, {})'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') - CheckDefFailure(['ch_setoptions(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list') enddef def Test_ch_status() if !has('channel') CheckFeature channel endif - CheckDefAndScriptFailure2(['ch_status(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') - CheckDefAndScriptFailure2(['ch_status(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') enddef def Test_char2nr() --- 435,528 ---- def Test_ch_info() if !has('channel') CheckFeature channel + else + CheckDefFailure(['ch_info([1])'], 'E1013: Argument 1: type mismatch, expected channel but got list') endif enddef def Test_ch_logfile() if !has('channel') CheckFeature channel ! else ! assert_fails('ch_logfile(true)', 'E1174:') ! assert_fails('ch_logfile("foo", true)', 'E1174:') ! CheckDefAndScriptFailure2(['ch_logfile(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['ch_logfile("a", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2') ! endif enddef def Test_ch_open() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_open({"a": 10}, "a")'], 'E1013: Argument 1: type mismatch, expected string but got dict', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['ch_open("a", [1])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') endif enddef def Test_ch_read() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_read(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') + CheckDefAndScriptFailure2(['ch_read(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') endif enddef def Test_ch_readblob() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_readblob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') + CheckDefAndScriptFailure2(['ch_readblob(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') endif enddef def Test_ch_readraw() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_readraw(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') + CheckDefAndScriptFailure2(['ch_readraw(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') + endif + enddef + + def Test_ch_sendexpr() + if !has('channel') + CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_sendexpr(1, "a")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1218: Channel or Job required for argument 1') + CheckDefAndScriptFailure2(['ch_sendexpr(test_null_channel(), 1, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') + endif + enddef + + def Test_ch_sendraw() + if !has('channel') + CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_sendraw(1, "")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1218: Channel or Job required for argument 1') + CheckDefAndScriptFailure2(['ch_sendraw(test_null_channel(), 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['ch_sendraw(test_null_channel(), "", [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') endif enddef def Test_ch_setoptions() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_setoptions(1, {})'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') + CheckDefFailure(['ch_setoptions(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list') endif enddef def Test_ch_status() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['ch_status(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument') + CheckDefAndScriptFailure2(['ch_status(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E715: Dictionary required') endif enddef def Test_char2nr() *************** *** 538,543 **** --- 590,604 ---- bw! enddef + def Test_complete() + CheckDefAndScriptFailure2(['complete("1", [])'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['complete(1, {})'], 'E1013: Argument 2: type mismatch, expected list but got dict', 'E1211: List required for argument 2') + enddef + + def Test_complete_add() + CheckDefAndScriptFailure2(['complete_add([])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + enddef + def Test_complete_info() CheckDefFailure(['complete_info("")'], 'E1013: Argument 1: type mismatch, expected list but got string') CheckDefFailure(['complete_info({})'], 'E1013: Argument 1: type mismatch, expected list but got dict') *************** *** 576,581 **** --- 637,648 ---- def Test_count() count('ABC ABC ABC', 'b', true)->assert_equal(3) count('ABC ABC ABC', 'b', false)->assert_equal(0) + CheckDefAndScriptFailure2(['count(10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['count("a", [1], 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') + CheckDefAndScriptFailure2(['count("a", [1], 0, "b")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4') + count([1, 2, 2, 3], 2)->assert_equal(2) + count([1, 2, 2, 3], 2, false, 2)->assert_equal(1) + count({a: 1.1, b: 2.2, c: 1.1}, 1.1)->assert_equal(2) enddef def Test_cursor() *************** *** 590,595 **** --- 657,665 ---- cursor('2', 1) END CheckDefExecAndScriptFailure(lines, 'E1209:') + CheckDefAndScriptFailure2(['cursor(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected number but got blob', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['cursor(1, "2")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['cursor(1, 2, "3")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') enddef def Test_debugbreak() *************** *** 597,602 **** --- 667,676 ---- CheckDefFailure(['debugbreak("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_deepcopy() + CheckDefAndScriptFailure2(['deepcopy({}, 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + enddef + def Test_delete() var res: bool = delete('doesnotexist') assert_equal(true, res) *************** *** 605,610 **** --- 679,690 ---- CheckDefFailure(['delete("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number') enddef + def Test_deletebufline() + CheckDefAndScriptFailure2(['deletebufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['deletebufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['deletebufline("a", 2, 0z10)'], 'E1013: Argument 3: type mismatch, expected string but got blob', 'E1174: String required for argument 3') + enddef + def Test_diff_filler() CheckDefFailure(['diff_filler([])'], 'E1013: Argument 1: type mismatch, expected string but got list') CheckDefFailure(['diff_filler(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') *************** *** 670,675 **** --- 750,758 ---- split SomeFile expand('%', true, true)->assert_equal(['SomeFile']) close + CheckDefAndScriptFailure2(['expand(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['expand("a", 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + CheckDefAndScriptFailure2(['expand("a", true, 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') enddef def Test_expandcmd() *************** *** 858,863 **** --- 941,948 ---- echo flatten([1, 2, 3]) END CheckDefAndScriptFailure(lines, 'E1158:') + CheckDefAndScriptFailure2(['flattennew({})'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['flattennew([], "1")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') enddef " Test for float functions argument type *************** *** 1033,1038 **** --- 1118,1126 ---- getbufline(-1, 1, '$')->assert_equal([]) bwipe! + CheckDefAndScriptFailure2(['getbufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['getbufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['getbufline("a", 2, 0z10)'], 'E1013: Argument 3: type mismatch, expected string but got blob', 'E1174: String required for argument 3') enddef def Test_getchangelist() *************** *** 1062,1085 **** CheckDefAndScriptFailure2(['getcharstr("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool') enddef - def Test_getenv() - if getenv('does-not_exist') == '' - assert_report('getenv() should return null') - endif - if getenv('does-not_exist') == null - else - assert_report('getenv() should return null') - endif - $SOMEENVVAR = 'some' - assert_equal('some', getenv('SOMEENVVAR')) - unlet $SOMEENVVAR - enddef - def Test_getcompletion() set wildignore=*.vim,*~ var l = getcompletion('run', 'file', true) l->assert_equal([]) set wildignore& enddef def Test_getcurpos() --- 1150,1163 ---- CheckDefAndScriptFailure2(['getcharstr("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool') enddef def Test_getcompletion() set wildignore=*.vim,*~ var l = getcompletion('run', 'file', true) l->assert_equal([]) set wildignore& + CheckDefAndScriptFailure2(['getcompletion(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['getcompletion("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['getcompletion("a", "b", 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') enddef def Test_getcurpos() *************** *** 1096,1101 **** --- 1174,1192 ---- CheckDefFailure(['getcwd(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') enddef + def Test_getenv() + if getenv('does-not_exist') == '' + assert_report('getenv() should return null') + endif + if getenv('does-not_exist') == null + else + assert_report('getenv() should return null') + endif + $SOMEENVVAR = 'some' + assert_equal('some', getenv('SOMEENVVAR')) + unlet $SOMEENVVAR + enddef + def Test_getfontname() CheckDefFailure(['getfontname(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') enddef *************** *** 1204,1209 **** --- 1295,1303 ---- setreg('a', lines) getreg('a', true, true)->assert_equal(lines) assert_fails('getreg("ab")', 'E1162:') + CheckDefAndScriptFailure2(['getreg(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['getreg(".", 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + CheckDefAndScriptFailure2(['getreg(".", 1, "b")'], 'E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3') enddef def Test_getreg_return_type() *************** *** 1230,1235 **** --- 1324,1340 ---- CheckDefFailure(['gettabinfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_gettabvar() + CheckDefAndScriptFailure2(['gettabvar("a", "b")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['gettabvar(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + enddef + + def Test_gettabwinvar() + CheckDefAndScriptFailure2(['gettabwinvar("a", 2, "c")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['gettabwinvar(1, "b", "c", [])'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['gettabwinvar(1, 1, 3, {})'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + enddef + def Test_gettagstack() CheckDefFailure(['gettagstack("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef *************** *** 1247,1254 **** --- 1352,1368 ---- CheckDefFailure(['getwinpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_getwinvar() + CheckDefAndScriptFailure2(['getwinvar("a", "b")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['getwinvar(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + enddef + def Test_glob() glob('runtest.vim', true, true, true)->assert_equal(['runtest.vim']) + CheckDefAndScriptFailure2(['glob(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['glob("a", 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + CheckDefAndScriptFailure2(['glob("a", 1, "b")'], 'E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3') + CheckDefAndScriptFailure2(['glob("a", 1, true, 2)'], 'E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4') enddef def Test_glob2regpat() *************** *** 1258,1267 **** --- 1372,1388 ---- def Test_globpath() globpath('.', 'runtest.vim', true, true, true)->assert_equal(['./runtest.vim']) + CheckDefAndScriptFailure2(['globpath(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['globpath("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['globpath("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3') + CheckDefAndScriptFailure2(['globpath("a", "b", true, "d")'], 'E1013: Argument 4: type mismatch, expected bool but got string', 'E1212: Bool required for argument 4') + CheckDefAndScriptFailure2(['globpath("a", "b", true, false, "e")'], 'E1013: Argument 5: type mismatch, expected bool but got string', 'E1212: Bool required for argument 5') enddef def Test_has() has('eval', true)->assert_equal(1) + CheckDefAndScriptFailure2(['has(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['has("a", "b")'], 'E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2') enddef def Test_has_key() *************** *** 1286,1291 **** --- 1407,1415 ---- iabbrev foo foobar hasmapto('foobar', 'i', true)->assert_equal(1) iunabbrev foo + CheckDefAndScriptFailure2(['hasmapto(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['hasmapto("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['hasmapto("a", "b", 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') enddef def Test_histadd() *************** *** 1330,1335 **** --- 1454,1462 ---- def Test_index() index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3) + CheckDefAndScriptFailure2(['index("a", "a")'], 'E1013: Argument 1: type mismatch, expected list but got string', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['index([1], 1.1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + CheckDefAndScriptFailure2(['index(0z1020, [1], 1, 2)'], 'E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4') enddef def Test_input() *************** *** 1458,1463 **** --- 1585,1600 ---- endif enddef + def Test_job_setoptions() + if !has('job') + CheckFeature job + else + CheckDefAndScriptFailure2(['job_setoptions(test_null_channel(), {})'], 'E1013: Argument 1: type mismatch, expected job but got channel', 'E1219: Job required for argument 1') + CheckDefAndScriptFailure2(['job_setoptions(test_null_job(), [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') + assert_equal('fail', job_status(test_null_job())) + endif + enddef + def Test_job_status() if !has('job') CheckFeature job *************** *** 1467,1472 **** --- 1604,1623 ---- endif enddef + def Test_job_stop() + if !has('job') + CheckFeature job + else + CheckDefAndScriptFailure2(['job_stop("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E1219: Job required for argument 1') + CheckDefAndScriptFailure2(['job_stop(test_null_job(), true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2') + endif + enddef + + def Test_join() + CheckDefAndScriptFailure2(['join("abc")'], 'E1013: Argument 1: type mismatch, expected list but got string', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['join([], 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + enddef + def Test_js_decode() CheckDefFailure(['js_decode(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') assert_equal([1, 2], js_decode('[1,2]')) *************** *** 1512,1517 **** --- 1663,1673 ---- list2str(l, true)->assert_equal(s) enddef + def Test_list2str() + CheckDefAndScriptFailure2(['list2str(".", true)'], 'E1013: Argument 1: type mismatch, expected list but got string', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['list2str([1], 0z10)'], 'E1013: Argument 2: type mismatch, expected bool but got blob', 'E1212: Bool required for argument 2') + enddef + def SID(): number return expand('') ->matchstr('\zs\d\+\ze_$') *************** *** 1526,1531 **** --- 1682,1708 ---- CheckDefAndScriptFailure2(['listener_remove("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number') enddef + def Test_map_failure() + CheckFeature job + + var lines =<< trim END + vim9script + writefile([], 'Xtmpfile') + silent e Xtmpfile + var d = {[bufnr('%')]: {a: 0}} + au BufReadPost * Func() + def Func() + if d->has_key('') + endif + eval d[expand('')]->mapnew((_, v: dict) => 0) + enddef + e + END + CheckScriptFailure(lines, 'E1013:') + au! BufReadPost + delete('Xtmpfile') + enddef + def Test_map_function_arg() var lines =<< trim END def MapOne(i: number, v: string): string *************** *** 1591,1602 **** rhs: 'bar', buffer: 0}) unmap foo ! enddef ! ! def Test_mapcheck() ! iabbrev foo foobar ! mapcheck('foo', 'i', true)->assert_equal('foobar') ! iunabbrev foo enddef def Test_maparg_mapset() --- 1768,1777 ---- rhs: 'bar', buffer: 0}) unmap foo ! CheckDefAndScriptFailure2(['maparg(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['maparg("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') ! CheckDefAndScriptFailure2(['maparg("a", "b", 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') ! CheckDefAndScriptFailure2(['maparg("a", "b", true, 2)'], 'E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4') enddef def Test_maparg_mapset() *************** *** 1607,1631 **** nunmap enddef ! def Test_map_failure() ! CheckFeature job ! var lines =<< trim END ! vim9script ! writefile([], 'Xtmpfile') ! silent e Xtmpfile ! var d = {[bufnr('%')]: {a: 0}} ! au BufReadPost * Func() ! def Func() ! if d->has_key('') ! endif ! eval d[expand('')]->mapnew((_, v: dict) => 0) ! enddef ! e ! END ! CheckScriptFailure(lines, 'E1013:') ! au! BufReadPost ! delete('Xtmpfile') enddef def Test_match() --- 1782,1800 ---- nunmap enddef ! def Test_mapcheck() ! iabbrev foo foobar ! mapcheck('foo', 'i', true)->assert_equal('foobar') ! iunabbrev foo ! CheckDefAndScriptFailure2(['mapcheck(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['mapcheck("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') ! CheckDefAndScriptFailure2(['mapcheck("a", "b", 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') ! enddef ! def Test_mapset() ! CheckDefAndScriptFailure2(['mapset(1, true, {})'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['mapset("a", 2, {})'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') ! CheckDefAndScriptFailure2(['mapset("a", false, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') enddef def Test_match() *************** *** 1668,1673 **** --- 1837,1854 ---- assert_equal(5, matchend(['a', 'b', 'c', 'b', 'd', 'b'], 'b', 2, 2)) enddef + def Test_matchfuzzy() + CheckDefAndScriptFailure2(['matchfuzzy({}, "p")'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['matchfuzzy([], 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['matchfuzzy([], "a", [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') + enddef + + def Test_matchfuzzypos() + CheckDefAndScriptFailure2(['matchfuzzypos({}, "p")'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['matchfuzzypos([], 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['matchfuzzypos([], "a", [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') + enddef + def Test_matchlist() CheckDefAndScriptFailure2(['matchlist(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1') CheckDefAndScriptFailure2(['matchlist(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') *************** *** 1781,1786 **** --- 1962,1969 ---- def Test_nr2char() nr2char(97, true)->assert_equal('a') + CheckDefAndScriptFailure2(['nr2char("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['nr2char(1, "a")'], 'E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2') enddef def Test_or() *************** *** 1906,1914 **** def Test_prompt_setprompt() if !has('channel') CheckFeature channel endif ! CheckDefAndScriptFailure2(['prompt_setprompt([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') ! CheckDefAndScriptFailure2(['prompt_setprompt(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') enddef def Test_prop_find() --- 2089,2110 ---- def Test_prompt_setprompt() if !has('channel') CheckFeature channel + else + CheckDefAndScriptFailure2(['prompt_setprompt([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['prompt_setprompt(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') endif ! enddef ! ! def Test_prop_add() ! CheckDefAndScriptFailure2(['prop_add("a", 2, {})'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') ! CheckDefAndScriptFailure2(['prop_add(1, "b", {})'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') ! CheckDefAndScriptFailure2(['prop_add(1, 2, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') ! enddef ! ! def Test_prop_clear() ! CheckDefAndScriptFailure2(['prop_clear("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') ! CheckDefAndScriptFailure2(['prop_clear(1, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') ! CheckDefAndScriptFailure2(['prop_clear(1, 2, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') enddef def Test_prop_find() *************** *** 1922,1927 **** --- 2118,2129 ---- CheckDefAndScriptFailure2(['prop_list(1, [])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') enddef + def Test_prop_remove() + CheckDefAndScriptFailure2(['prop_remove([])'], 'E1013: Argument 1: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 1') + CheckDefAndScriptFailure2(['prop_remove({}, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['prop_remove({}, 1, "b")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + enddef + def Test_prop_type_add() CheckDefAndScriptFailure2(['prop_type_add({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict', 'E731: Using a Dictionary as a String') CheckDefAndScriptFailure2(['prop_type_add("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict but got string', 'E715: Dictionary required') *************** *** 2053,2058 **** --- 2255,2269 ---- assert_true(type(reltimestr(reltime())) == v:t_string) enddef + def Test_remote_expr() + CheckFeature clientserver + CheckEnv DISPLAY + CheckDefAndScriptFailure2(['remote_expr(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['remote_expr("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['remote_expr("a", "b", 3)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + CheckDefAndScriptFailure2(['remote_expr("a", "b", "c", "d")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4') + enddef + def Test_remote_foreground() CheckFeature clientserver # remote_foreground() doesn't fail on MS-Windows *************** *** 2077,2082 **** --- 2288,2301 ---- CheckDefAndScriptFailure2(['remote_read("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') enddef + def Test_remote_send() + CheckFeature clientserver + CheckEnv DISPLAY + CheckDefAndScriptFailure2(['remote_send(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['remote_send("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['remote_send("a", "b", 3)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + enddef + def Test_remote_startserver() CheckFeature clientserver CheckEnv DISPLAY *************** *** 2089,2094 **** --- 2308,2338 ---- assert_equal([3, 4], l) enddef + def Test_remove() + CheckDefAndScriptFailure2(['remove("a", 1)'], 'E1013: Argument 1: type mismatch, expected list but got string', 'E896: Argument of remove() must be a List, Dictionary or Blob') + CheckDefAndScriptFailure2(['remove([], "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['remove([], 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + CheckDefAndScriptFailure2(['remove({}, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['remove(0z10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['remove(0z20, 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + var l: any = [1, 2, 3, 4] + remove(l, 1) + assert_equal([1, 3, 4], l) + remove(l, 0, 1) + assert_equal([4], l) + var b: any = 0z1234.5678.90 + remove(b, 1) + assert_equal(0z1256.7890, b) + remove(b, 1, 2) + assert_equal(0z1290, b) + var d: any = {a: 10, b: 20, c: 30} + remove(d, 'b') + assert_equal({a: 10, c: 30}, d) + var d2: any = {1: 'a', 2: 'b', 3: 'c'} + remove(d2, 2) + assert_equal({1: 'a', 3: 'c'}, d2) + enddef + def Test_remove_return_type() var l = remove({one: [1, 2], two: [3, 4]}, 'one') var res = 0 *************** *** 2202,2207 **** --- 2446,2458 ---- CheckDefAndScriptFailure2(['searchcount([1])'], 'E1013: Argument 1: type mismatch, expected dict but got list', 'E715: Dictionary required') enddef + def Test_searchdecl() + searchdecl('blah', true, true)->assert_equal(1) + CheckDefAndScriptFailure2(['searchdecl(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['searchdecl("a", 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + CheckDefAndScriptFailure2(['searchdecl("a", true, 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') + enddef + def Test_searchpair() new setline(1, "here { and } there") *************** *** 2247,2252 **** --- 2498,2508 ---- CheckDefAndScriptFailure2(['server2client("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E573: Invalid server id used:') enddef + def Test_shellescape() + CheckDefAndScriptFailure2(['shellescape(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['shellescape("a", 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') + enddef + def Test_set_get_bufline() # similar to Test_setbufline_getbufline() var lines =<< trim END *************** *** 2297,2306 **** CheckDefAndScriptSuccess(lines) enddef - def Test_searchdecl() - searchdecl('blah', true, true)->assert_equal(1) - enddef - def Test_setbufvar() setbufvar(bufnr('%'), '&syntax', 'vim') &syntax->assert_equal('vim') --- 2553,2558 ---- *************** *** 2326,2348 **** getbufvar('%', 'myvar')->assert_equal(123) enddef - def Test_setcharsearch() - CheckDefFailure(['setcharsearch("x")'], 'E1013: Argument 1: type mismatch, expected dict but got string') - CheckDefFailure(['setcharsearch([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') - var d: dict = {char: 'x', forward: 1, until: 1} - setcharsearch(d) - assert_equal(d, getcharsearch()) - enddef - - def Test_setcmdpos() - CheckDefFailure(['setcmdpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') - enddef - - def Test_setfperm() - CheckDefFailure(['setfperm(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number') - CheckDefFailure(['setfperm("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob') - enddef - def Test_setbufline() new var bnum = bufnr('%') --- 2578,2583 ---- *************** *** 2364,2369 **** --- 2599,2633 ---- CheckDefAndScriptFailure2(['setcellwidths({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E714: List required') enddef + def Test_setcharpos() + CheckDefAndScriptFailure2(['setcharpos(1, [])'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefFailure(['setcharpos(".", ["a"])'], 'E1013: Argument 2: type mismatch, expected list but got list') + CheckDefAndScriptFailure2(['setcharpos(".", 1)'], 'E1013: Argument 2: type mismatch, expected list but got number', 'E1211: List required for argument 2') + enddef + + def Test_setcharsearch() + CheckDefFailure(['setcharsearch("x")'], 'E1013: Argument 1: type mismatch, expected dict but got string') + CheckDefFailure(['setcharsearch([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') + var d: dict = {char: 'x', forward: 1, until: 1} + setcharsearch(d) + assert_equal(d, getcharsearch()) + enddef + + def Test_setcmdpos() + CheckDefFailure(['setcmdpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') + enddef + + def Test_setcursorcharpos() + CheckDefAndScriptFailure2(['setcursorcharpos(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected number but got blob', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['setcursorcharpos(1, "2")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['setcursorcharpos(1, 2, "3")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + enddef + + def Test_setfperm() + CheckDefFailure(['setfperm(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['setfperm("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob') + enddef + def Test_setline() new setline(1, range(1, 4)) *************** *** 2383,2388 **** --- 2647,2673 ---- var what = {items: items} setqflist([], ' ', what) setloclist(0, [], ' ', what) + CheckDefAndScriptFailure2(['setloclist("1", [])'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['setloclist(1, 2)'], 'E1013: Argument 2: type mismatch, expected list but got number', 'E1211: List required for argument 2') + CheckDefAndScriptFailure2(['setloclist(1, [], 3)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + CheckDefAndScriptFailure2(['setloclist(1, [], "a", [])'], 'E1013: Argument 4: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 4') + enddef + + def Test_setmatches() + CheckDefAndScriptFailure2(['setmatches({})'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['setmatches([], "1")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + enddef + + def Test_setpos() + CheckDefAndScriptFailure2(['setpos(1, [])'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefFailure(['setpos(".", ["a"])'], 'E1013: Argument 2: type mismatch, expected list but got list') + CheckDefAndScriptFailure2(['setpos(".", 1)'], 'E1013: Argument 2: type mismatch, expected list but got number', 'E1211: List required for argument 2') + enddef + + def Test_setqflist() + CheckDefAndScriptFailure2(['setqflist(1, "")'], 'E1013: Argument 1: type mismatch, expected list but got number', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['setqflist([], 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['setqflist([], "", [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') enddef def Test_setreg() *************** *** 2393,2398 **** --- 2678,2705 ---- assert_fails('setreg("ab", 0)', 'E1162:') enddef + def Test_settabvar() + CheckDefAndScriptFailure2(['settabvar("a", "b", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['settabvar(1, 2, "c")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + enddef + + def Test_settabwinvar() + CheckDefAndScriptFailure2(['settabwinvar("a", 2, "c", true)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['settabwinvar(1, "b", "c", [])'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['settabwinvar(1, 1, 3, {})'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + enddef + + def Test_settagstack() + CheckDefAndScriptFailure2(['settagstack(true, {})'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['settagstack(1, [1])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') + CheckDefAndScriptFailure2(['settagstack(1, {}, 2)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3') + enddef + + def Test_setwinvar() + CheckDefAndScriptFailure2(['setwinvar("a", "b", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['setwinvar(1, 2, "c")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + enddef + def Test_sha256() CheckDefFailure(['sha256(100)'], 'E1013: Argument 1: type mismatch, expected string but got number') CheckDefFailure(['sha256(0zABCD)'], 'E1013: Argument 1: type mismatch, expected string but got blob') *************** *** 2414,2419 **** --- 2721,2732 ---- CheckDefAndScriptFailure2(['sign_getdefined(2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') enddef + def Test_sign_getplaced() + CheckDefAndScriptFailure2(['sign_getplaced(["x"])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['sign_getplaced(1, ["a"])'], 'E1013: Argument 2: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 2') + CheckDefAndScriptFailure2(['sign_getplaced("a", 1.1)'], 'E1013: Argument 2: type mismatch, expected dict but got float', 'E1206: Dictionary required for argument 2') + enddef + def Test_sign_placelist() CheckDefAndScriptFailure2(['sign_placelist("x")'], 'E1013: Argument 1: type mismatch, expected list but got string', 'E714: List required') CheckDefAndScriptFailure2(['sign_placelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E714: List required') *************** *** 2461,2466 **** --- 2774,2782 ---- assert_equal(0z11, slice(0z001122334455, 1, -4)) assert_equal(0z, slice(0z001122334455, 1, -5)) assert_equal(0z, slice(0z001122334455, 1, -6)) + CheckDefAndScriptFailure2(['slice({"a": 10}, 1)'], 'E1013: Argument 1: type mismatch, expected list but got dict', 'E1211: List required for argument 1') + CheckDefAndScriptFailure2(['slice([1, 2, 3], "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['slice("abc", 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') enddef def Test_spellsuggest() *************** *** 2469,2474 **** --- 2785,2793 ---- else spellsuggest('marrch', 1, true)->assert_equal(['March']) endif + CheckDefAndScriptFailure2(['spellsuggest(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['spellsuggest("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['spellsuggest("a", 1, 0z01)'], 'E1013: Argument 3: type mismatch, expected bool but got blob', 'E1212: Bool required for argument 3') enddef def Test_sound_stop() *************** *** 2508,2513 **** --- 2827,2835 ---- def Test_split() split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) + CheckDefAndScriptFailure2(['split(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['split("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2') + CheckDefAndScriptFailure2(['split("a", "b", 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') enddef def Test_srand() *************** *** 2557,2562 **** --- 2879,2891 ---- strcharlen(99)->assert_equal(2) enddef + def Test_strcharpart() + CheckDefAndScriptFailure2(['strcharpart(1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['strcharpart("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['strcharpart("a", 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + CheckDefAndScriptFailure2(['strcharpart("a", 1, 1, 2)'], 'E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4') + enddef + def Test_strchars() strchars("A\u20dd", true)->assert_equal(1) CheckDefAndScriptFailure2(['strchars(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') *************** *** 2593,2598 **** --- 2922,2934 ---- strlen(99)->assert_equal(2) enddef + def Test_strpart() + CheckDefAndScriptFailure2(['strpart(1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['strpart("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['strpart("a", 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + CheckDefAndScriptFailure2(['strpart("a", 1, 1, 2)'], 'E1013: Argument 4: type mismatch, expected bool but got number', 'E1212: Bool required for argument 4') + enddef + def Test_strptime() CheckFunction strptime CheckDefFailure(['strptime(10, "2021")'], 'E1013: Argument 1: type mismatch, expected string but got number') *************** *** 2626,2631 **** --- 2962,2969 ---- var actual = substitute('A123456789', pat, Rep, '') var expected = "[['A123456789'], ['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']]" actual->assert_equal(expected) + CheckDefAndScriptFailure2(['submatch("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['submatch(1, "a")'], 'E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2') enddef def Test_substitute() *************** *** 2653,2658 **** --- 2991,2999 ---- setline(1, "text") synID(1, 1, true)->assert_equal(0) bwipe! + CheckDefAndScriptFailure2(['synID(0z10, 1, true)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['synID("a", true, false)'], 'E1013: Argument 2: type mismatch, expected number but got bool', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['synID(1, 1, 2)'], 'E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3') enddef def Test_synIDtrans() *************** *** 2753,2758 **** --- 3094,3101 ---- term_gettty(buf, true)->assert_notequal('') StopShellInTerminal(buf) endif + CheckDefAndScriptFailure2(['term_gettty([1])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['term_gettty(1, 2)'], 'E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2') enddef def Test_term_sendkeys() *************** *** 2761,2766 **** --- 3104,3115 ---- CheckDefAndScriptFailure2(['term_sendkeys(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list', 'E1174: String required for argument 2') enddef + def Test_term_setansicolors() + CheckRunVimInTerminal + CheckDefAndScriptFailure2(['term_setansicolors([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') + CheckDefAndScriptFailure2(['term_setansicolors(10, {})'], 'E1013: Argument 2: type mismatch, expected list but got dict', 'E1211: List required for argument 2') + enddef + def Test_term_setapi() CheckRunVimInTerminal CheckDefAndScriptFailure2(['term_setapi([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E1174: String required for argument 1') *************** *** 2811,2816 **** --- 3160,3174 ---- CheckDefAndScriptFailure2(['test_getvalue(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E474: Invalid argument') enddef + def Test_test_gui_mouse_event() + CheckGui + CheckDefAndScriptFailure2(['test_gui_mouse_event(1.1, 1, 1, 1, 1)'], 'E1013: Argument 1: type mismatch, expected number but got float', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['test_gui_mouse_event(1, "1", 1, 1, 1)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['test_gui_mouse_event(1, 1, "1", 1, 1)'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3') + CheckDefAndScriptFailure2(['test_gui_mouse_event(1, 1, 1, "1", 1)'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4') + CheckDefAndScriptFailure2(['test_gui_mouse_event(1, 1, 1, 1, "1")'], 'E1013: Argument 5: type mismatch, expected number but got string', 'E1210: Number required for argument 5') + enddef + def Test_test_ignore_error() CheckDefAndScriptFailure2(['test_ignore_error([])'], 'E1013: Argument 1: type mismatch, expected string but got list', 'E474: Invalid argument') test_ignore_error('RESET') *************** *** 2845,2850 **** --- 3203,3213 ---- assert_equal([], timer_info()) enddef + def Test_timer_pause() + CheckDefAndScriptFailure2(['timer_pause("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['timer_pause(1, "a")'], 'E1013: Argument 2: type mismatch, expected bool but got string', 'E1212: Bool required for argument 2') + enddef + def Test_timer_paused() var id = timer_start(50, () => 0) timer_pause(id, true) *************** *** 2955,2960 **** --- 3318,3326 ---- split win_splitmove(1, 2, {vertical: true, rightbelow: true}) close + CheckDefAndScriptFailure2(['win_splitmove("a", 2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1') + CheckDefAndScriptFailure2(['win_splitmove(1, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2') + CheckDefAndScriptFailure2(['win_splitmove(1, 2, [])'], 'E1013: Argument 3: type mismatch, expected dict but got list', 'E1206: Dictionary required for argument 3') enddef def Test_winbufnr() *** ../vim-8.2.3187/src/testing.c 2021-07-15 12:48:08.811766844 +0200 --- src/testing.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 1246,1260 **** int repeated_click; int_u mods; ! if (argvars[0].v_type != VAR_NUMBER ! || (argvars[1].v_type) != VAR_NUMBER ! || (argvars[2].v_type) != VAR_NUMBER ! || (argvars[3].v_type) != VAR_NUMBER ! || (argvars[4].v_type) != VAR_NUMBER) ! { ! emsg(_(e_invarg)); return; - } button = tv_get_number(&argvars[0]); row = tv_get_number(&argvars[1]); --- 1246,1257 ---- int repeated_click; int_u mods; ! if (check_for_number_arg(argvars, 0) == FAIL ! || check_for_number_arg(argvars, 1) == FAIL ! || check_for_number_arg(argvars, 2) == FAIL ! || check_for_number_arg(argvars, 3) == FAIL ! || check_for_number_arg(argvars, 4) == FAIL) return; button = tv_get_number(&argvars[0]); row = tv_get_number(&argvars[1]); *** ../vim-8.2.3187/src/textprop.c 2021-07-15 12:48:08.811766844 +0200 --- src/textprop.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 158,163 **** --- 158,169 ---- linenr_T start_lnum; colnr_T start_col; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL + || check_for_dict_arg(argvars, 2) == FAIL)) + return; + start_lnum = tv_get_number(&argvars[0]); start_col = tv_get_number(&argvars[1]); if (start_col < 1) *************** *** 532,543 **** void f_prop_clear(typval_T *argvars, typval_T *rettv UNUSED) { ! linenr_T start = tv_get_number(&argvars[0]); ! linenr_T end = start; linenr_T lnum; buf_T *buf = curbuf; int did_clear = FALSE; if (argvars[1].v_type != VAR_UNKNOWN) { end = tv_get_number(&argvars[1]); --- 538,558 ---- void f_prop_clear(typval_T *argvars, typval_T *rettv UNUSED) { ! linenr_T start; ! linenr_T end; linenr_T lnum; buf_T *buf = curbuf; int did_clear = FALSE; + if (in_vim9script() + && (check_for_number_arg(argvars, 0) == FAIL + || check_for_opt_number_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_dict_arg(argvars, 2) == FAIL))) + return; + + start = tv_get_number(&argvars[0]); + end = start; if (argvars[1].v_type != VAR_UNKNOWN) { end = tv_get_number(&argvars[1]); *************** *** 774,781 **** if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN && ! check_for_dict_arg(argvars, 1) == FAIL))) return; lnum = tv_get_number(&argvars[0]); --- 789,795 ---- if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ! || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; lnum = tv_get_number(&argvars[0]); *************** *** 832,837 **** --- 846,859 ---- int both; rettv->vval.v_number = 0; + + if (in_vim9script() + && (check_for_dict_arg(argvars, 0) == FAIL + || check_for_opt_number_arg(argvars, 1) == FAIL + || (argvars[1].v_type != VAR_UNKNOWN + && check_for_opt_number_arg(argvars, 2) == FAIL))) + return; + if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) { emsg(_(e_invarg)); *** ../vim-8.2.3187/src/time.c 2021-07-15 12:48:08.811766844 +0200 --- src/time.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 270,277 **** if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || (argvars[1].v_type != VAR_UNKNOWN ! && check_for_number_arg(argvars, 1) == FAIL))) return; rettv->v_type = VAR_STRING; --- 270,276 ---- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL ! || check_for_opt_number_arg(argvars, 1) == FAIL)) return; rettv->v_type = VAR_STRING; *************** *** 777,788 **** f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) { timer_T *timer = NULL; ! int paused = (int)tv_get_bool(&argvars[1]); if (argvars[0].v_type != VAR_NUMBER) emsg(_(e_number_exp)); else { timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) timer->tr_paused = paused; --- 776,792 ---- f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) { timer_T *timer = NULL; ! ! if (in_vim9script() ! && (check_for_number_arg(argvars, 0) == FAIL ! || check_for_bool_arg(argvars, 1) == FAIL)) ! return; if (argvars[0].v_type != VAR_NUMBER) emsg(_(e_number_exp)); else { + int paused = (int)tv_get_bool(&argvars[1]); timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) timer->tr_paused = paused; *** ../vim-8.2.3187/src/typval.c 2021-07-18 14:43:39.791940898 +0200 --- src/typval.c 2021-07-20 17:46:37.607626916 +0200 *************** *** 385,390 **** --- 385,400 ---- } /* + * Check for an optional string argument at 'idx' + */ + int + check_for_opt_string_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_string_arg(args, idx) != FAIL); + } + + /* * Give an error and return FAIL unless "args[idx]" is a number. */ int *************** *** 402,407 **** --- 412,427 ---- } /* + * Check for an optional number argument at 'idx' + */ + int + check_for_opt_number_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_number_arg(args, idx) != FAIL); + } + + /* * Give an error and return FAIL unless "args[idx]" is a bool. */ int *************** *** 422,427 **** --- 442,457 ---- } /* + * Check for an optional bool argument at 'idx' + */ + int + check_for_opt_bool_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_bool_arg(args, idx) != FAIL); + } + + /* * Give an error and return FAIL unless "args[idx]" is a list. */ int *************** *** 439,444 **** --- 469,484 ---- } /* + * Check for an optional list argument at 'idx' + */ + int + check_for_opt_list_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_list_arg(args, idx) != FAIL); + } + + /* * Give an error and return FAIL unless "args[idx]" is a dict. */ int *************** *** 453,458 **** --- 493,661 ---- return FAIL; } return OK; + } + + /* + * Check for an optional dict argument at 'idx' + */ + int + check_for_opt_dict_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_dict_arg(args, idx) != FAIL); + } + + /* + * Give an error and return FAIL unless "args[idx]" is a blob. + */ + int + check_for_blob_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_BLOB) + { + if (idx >= 0) + semsg(_(e_blob_required_for_argument_nr), idx + 1); + else + emsg(_(e_blobreq)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a channel or a job. + */ + int + check_for_chan_or_job_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_CHANNEL && args[idx].v_type != VAR_JOB) + { + if (idx >= 0) + semsg(_(e_chan_or_job_required_for_argument_nr), idx + 1); + else + emsg(_(e_chan_or_job_req)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a job. + */ + int + check_for_job_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_JOB) + { + if (idx >= 0) + semsg(_(e_job_required_for_argument_nr), idx + 1); + else + emsg(_(e_jobreq)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a string or + * a number. + */ + int + check_for_string_or_number_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_NUMBER) + { + if (idx >= 0) + semsg(_(e_string_required_for_argument_nr), idx + 1); + else + emsg(_(e_stringreq)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a string or + * a number (buffer) + */ + int + check_for_buffer_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_NUMBER) + { + if (idx >= 0) + semsg(_(e_string_required_for_argument_nr), idx + 1); + else + emsg(_(e_stringreq)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a string or + * a number (line) + */ + int + check_for_lnum_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_NUMBER) + { + if (idx >= 0) + semsg(_(e_string_required_for_argument_nr), idx + 1); + else + emsg(_(e_stringreq)); + return FAIL; + } + return OK; + } + + /* + * Give an error and return FAIL unless "args[idx]" is a string or + * a number (line) + */ + int + check_for_opt_lnum_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_UNKNOWN + && args[idx].v_type != VAR_STRING + && args[idx].v_type != VAR_NUMBER) + { + if (idx >= 0) + semsg(_(e_string_required_for_argument_nr), idx + 1); + else + emsg(_(e_stringreq)); + return FAIL; + } + return OK; + } + + /* + * Check for an optional string or number argument at 'idx' + */ + int + check_for_opt_string_or_number_arg(typval_T *args, int idx) + { + return (args[idx].v_type == VAR_UNKNOWN + || check_for_string_or_number_arg(args, idx) != FAIL); + } + + /* + * Give an error and return FAIL unless "args[idx]" is a string or + * a blob. + */ + int + check_for_string_or_blob_arg(typval_T *args, int idx) + { + if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_BLOB) + { + if (idx >= 0) + semsg(_(e_string_required_for_argument_nr), idx + 1); + else + emsg(_(e_stringreq)); + return FAIL; + } + return OK; } /* *** ../vim-8.2.3187/src/version.c 2021-07-19 22:19:25.690972401 +0200 --- src/version.c 2021-07-20 17:51:26.275747391 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3188, /**/ -- A computer program does what you tell it to do, not what you want it to do. /// 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 ///