To: vim_dev@googlegroups.com Subject: Patch 8.2.3084 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3084 Problem: Vim9: builtin function argument types are not checked at compile time. Solution: Add argument types. (Yegappan Lakshmanan, closes #8503) Files: src/evalfunc.c, src/testdir/test_functions.vim, src/testdir/test_glob2regpat.vim, src/testdir/test_vim9_builtin.vim, src/testdir/test_vim9_expr.vim *** ../vim-8.2.3083/src/evalfunc.c 2021-06-27 22:03:28.637707737 +0200 --- src/evalfunc.c 2021-07-03 11:57:02.997988712 +0200 *************** *** 268,273 **** --- 268,300 ---- } /* + * Check "type" is a dict of 'any'. + */ + static int + arg_dict_any(type_T *type, argcontext_T *context) + { + return check_arg_type(&t_dict_any, type, context); + } + + /* + * Check "type" is a list of numbers. + */ + static int + arg_list_number(type_T *type, argcontext_T *context) + { + return check_arg_type(&t_list_number, type, context); + } + + /* + * Check "type" is a list of strings. + */ + static int + arg_list_string(type_T *type, argcontext_T *context) + { + return check_arg_type(&t_list_string, type, context); + } + + /* * Check "type" is a string. */ static int *************** *** 302,307 **** --- 329,346 ---- } /* + * Check "type" is a string or a number + */ + static int + arg_string_or_nr(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. */ static int *************** *** 404,417 **** --- 443,464 ---- */ argcheck_T arg1_string[] = {arg_string}; argcheck_T arg1_number[] = {arg_number}; + argcheck_T arg1_dict[] = {arg_dict_any}; + argcheck_T arg1_list_number[] = {arg_list_number}; + argcheck_T arg1_string_list[] = {arg_list_string}; argcheck_T arg1_float_or_nr[] = {arg_float_or_nr}; + argcheck_T arg1_string_or_nr[] = {arg_string_or_nr}; + argcheck_T arg1_string_or_list[] = {arg_string_or_list}; argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr}; argcheck_T arg2_number[] = {arg_number, arg_number}; + argcheck_T arg2_string[] = {arg_string, arg_string}; + argcheck_T arg2_list_number[] = {arg_list_number, arg_list_number}; argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev}; argcheck_T arg2_execute[] = {arg_string_or_list, arg_string}; argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3}; argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3}; argcheck_T arg3_string[] = {arg_string, arg_string, arg_string}; + argcheck_T arg3_number[] = {arg_number, arg_number, arg_number}; argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool}; argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number}; *************** *** 732,738 **** NULL #endif }, ! {"balloon_show", 1, 1, FEARG_1, NULL, ret_void, #ifdef FEAT_BEVAL f_balloon_show --- 779,785 ---- NULL #endif }, ! {"balloon_show", 1, 1, FEARG_1, arg1_string_or_list, ret_void, #ifdef FEAT_BEVAL f_balloon_show *************** *** 740,746 **** NULL #endif }, ! {"balloon_split", 1, 1, FEARG_1, NULL, ret_list_string, #if defined(FEAT_BEVAL_TERM) f_balloon_split --- 787,793 ---- NULL #endif }, ! {"balloon_split", 1, 1, FEARG_1, arg1_string, ret_list_string, #if defined(FEAT_BEVAL_TERM) f_balloon_split *************** *** 752,782 **** ret_string, f_browse}, {"browsedir", 2, 2, 0, NULL, ret_string, f_browsedir}, ! {"bufadd", 1, 1, FEARG_1, NULL, ret_number, f_bufadd}, ! {"bufexists", 1, 1, FEARG_1, NULL, ret_number_bool, f_bufexists}, ! {"buffer_exists", 1, 1, FEARG_1, NULL, // obsolete ret_number_bool, f_bufexists}, ! {"buffer_name", 0, 1, FEARG_1, NULL, // obsolete ret_string, f_bufname}, {"buffer_number", 0, 1, FEARG_1, NULL, // obsolete ret_number, f_bufnr}, ! {"buflisted", 1, 1, FEARG_1, NULL, ret_number_bool, f_buflisted}, ! {"bufload", 1, 1, FEARG_1, NULL, ret_void, f_bufload}, ! {"bufloaded", 1, 1, FEARG_1, NULL, ret_number_bool, f_bufloaded}, ! {"bufname", 0, 1, FEARG_1, NULL, ret_string, f_bufname}, {"bufnr", 0, 2, FEARG_1, NULL, ret_number, f_bufnr}, ! {"bufwinid", 1, 1, FEARG_1, NULL, ret_number, f_bufwinid}, ! {"bufwinnr", 1, 1, FEARG_1, NULL, ret_number, f_bufwinnr}, ! {"byte2line", 1, 1, FEARG_1, NULL, ret_number, f_byte2line}, {"byteidx", 2, 2, FEARG_1, NULL, ret_number, f_byteidx}, --- 799,829 ---- ret_string, f_browse}, {"browsedir", 2, 2, 0, NULL, ret_string, f_browsedir}, ! {"bufadd", 1, 1, FEARG_1, arg1_string, ret_number, f_bufadd}, ! {"bufexists", 1, 1, FEARG_1, arg1_string_or_nr, ret_number_bool, f_bufexists}, ! {"buffer_exists", 1, 1, FEARG_1, arg1_string_or_nr, // obsolete 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}, ! {"bufload", 1, 1, FEARG_1, arg1_string_or_nr, ret_void, f_bufload}, ! {"bufloaded", 1, 1, FEARG_1, arg1_string_or_nr, 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}, ! {"bufwinnr", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_bufwinnr}, ! {"byte2line", 1, 1, FEARG_1, arg1_number, ret_number, f_byte2line}, {"byteidx", 2, 2, FEARG_1, NULL, ret_number, f_byteidx}, *************** *** 826,840 **** ret_number, f_changenr}, {"char2nr", 1, 2, FEARG_1, NULL, ret_number, f_char2nr}, ! {"charclass", 1, 1, FEARG_1, NULL, ret_number, f_charclass}, {"charcol", 1, 1, FEARG_1, NULL, ret_number, f_charcol}, {"charidx", 2, 3, FEARG_1, NULL, ret_number, f_charidx}, ! {"chdir", 1, 1, FEARG_1, NULL, ret_string, f_chdir}, ! {"cindent", 1, 1, FEARG_1, NULL, ret_number, f_cindent}, {"clearmatches", 0, 1, FEARG_1, arg1_number, ret_void, f_clearmatches}, --- 873,887 ---- ret_number, f_changenr}, {"char2nr", 1, 2, FEARG_1, NULL, ret_number, f_char2nr}, ! {"charclass", 1, 1, FEARG_1, arg1_string, ret_number, f_charclass}, {"charcol", 1, 1, FEARG_1, NULL, ret_number, f_charcol}, {"charidx", 2, 3, FEARG_1, NULL, ret_number, f_charidx}, ! {"chdir", 1, 1, FEARG_1, arg1_string, ret_string, f_chdir}, ! {"cindent", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_cindent}, {"clearmatches", 0, 1, FEARG_1, arg1_number, ret_void, f_clearmatches}, *************** *** 846,852 **** ret_number, f_complete_add}, {"complete_check", 0, 0, 0, NULL, ret_number_bool, f_complete_check}, ! {"complete_info", 0, 1, FEARG_1, NULL, ret_dict_any, f_complete_info}, {"confirm", 1, 4, FEARG_1, NULL, ret_number, f_confirm}, --- 893,899 ---- ret_number, f_complete_add}, {"complete_check", 0, 0, 0, NULL, ret_number_bool, f_complete_check}, ! {"complete_info", 0, 1, FEARG_1, arg1_string_list, ret_dict_any, f_complete_info}, {"confirm", 1, 4, FEARG_1, NULL, ret_number, f_confirm}, *************** *** 878,884 **** ret_number_bool, f_deletebufline}, {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, ! {"diff_filler", 1, 1, FEARG_1, NULL, ret_number, f_diff_filler}, {"diff_hlID", 2, 2, FEARG_1, NULL, ret_number, f_diff_hlID}, --- 925,931 ---- ret_number_bool, f_deletebufline}, {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, ! {"diff_filler", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_diff_filler}, {"diff_hlID", 2, 2, FEARG_1, NULL, ret_number, f_diff_hlID}, *************** *** 888,924 **** ret_number_bool, f_empty}, {"environ", 0, 0, 0, NULL, ret_dict_string, f_environ}, ! {"escape", 2, 2, FEARG_1, NULL, ret_string, f_escape}, ! {"eval", 1, 1, FEARG_1, NULL, ret_any, f_eval}, {"eventhandler", 0, 0, 0, NULL, ret_number_bool, f_eventhandler}, ! {"executable", 1, 1, FEARG_1, NULL, ret_number, f_executable}, {"execute", 1, 2, FEARG_1, arg2_execute, ret_string, f_execute}, ! {"exepath", 1, 1, FEARG_1, NULL, ret_string, f_exepath}, ! {"exists", 1, 1, FEARG_1, NULL, 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, NULL, ret_string, f_expandcmd}, {"extend", 2, 3, FEARG_1, arg23_extend, ret_first_arg, f_extend}, {"extendnew", 2, 3, FEARG_1, arg23_extendnew, ret_first_cont, f_extendnew}, ! {"feedkeys", 1, 2, FEARG_1, NULL, ret_void, f_feedkeys}, ! {"file_readable", 1, 1, FEARG_1, NULL, // obsolete ret_number_bool, f_filereadable}, ! {"filereadable", 1, 1, FEARG_1, NULL, ret_number_bool, f_filereadable}, ! {"filewritable", 1, 1, FEARG_1, NULL, ret_number, f_filewritable}, {"filter", 2, 2, FEARG_1, NULL, ret_first_arg, f_filter}, --- 935,971 ---- ret_number_bool, f_empty}, {"environ", 0, 0, 0, NULL, ret_dict_string, f_environ}, ! {"escape", 2, 2, FEARG_1, arg2_string, ret_string, f_escape}, ! {"eval", 1, 1, FEARG_1, arg1_string, ret_any, f_eval}, {"eventhandler", 0, 0, 0, NULL, ret_number_bool, f_eventhandler}, ! {"executable", 1, 1, FEARG_1, arg1_string, ret_number, f_executable}, {"execute", 1, 2, FEARG_1, arg2_execute, ret_string, f_execute}, ! {"exepath", 1, 1, FEARG_1, arg1_string, ret_string, f_exepath}, ! {"exists", 1, 1, FEARG_1, arg1_string, 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}, {"extend", 2, 3, FEARG_1, arg23_extend, ret_first_arg, f_extend}, {"extendnew", 2, 3, FEARG_1, arg23_extendnew, ret_first_cont, f_extendnew}, ! {"feedkeys", 1, 2, FEARG_1, arg2_string, ret_void, f_feedkeys}, ! {"file_readable", 1, 1, FEARG_1, arg1_string, // obsolete ret_number_bool, f_filereadable}, ! {"filereadable", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_filereadable}, ! {"filewritable", 1, 1, FEARG_1, arg1_string, ret_number, f_filewritable}, {"filter", 2, 2, FEARG_1, NULL, ret_first_arg, f_filter}, *************** *** 936,954 **** ret_float, FLOAT_FUNC(f_floor)}, {"fmod", 2, 2, FEARG_1, arg2_float_or_nr, ret_float, FLOAT_FUNC(f_fmod)}, ! {"fnameescape", 1, 1, FEARG_1, NULL, ret_string, f_fnameescape}, ! {"fnamemodify", 2, 2, FEARG_1, NULL, ret_string, f_fnamemodify}, ! {"foldclosed", 1, 1, FEARG_1, NULL, ret_number, f_foldclosed}, ! {"foldclosedend", 1, 1, FEARG_1, NULL, ret_number, f_foldclosedend}, ! {"foldlevel", 1, 1, FEARG_1, NULL, ret_number, f_foldlevel}, {"foldtext", 0, 0, 0, NULL, ret_string, f_foldtext}, ! {"foldtextresult", 1, 1, FEARG_1, NULL, ret_string, f_foldtextresult}, {"foreground", 0, 0, 0, NULL, ret_void, f_foreground}, --- 983,1001 ---- ret_float, FLOAT_FUNC(f_floor)}, {"fmod", 2, 2, FEARG_1, arg2_float_or_nr, ret_float, FLOAT_FUNC(f_fmod)}, ! {"fnameescape", 1, 1, FEARG_1, arg1_string, ret_string, f_fnameescape}, ! {"fnamemodify", 2, 2, FEARG_1, arg2_string, ret_string, f_fnamemodify}, ! {"foldclosed", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_foldclosed}, ! {"foldclosedend", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_foldclosedend}, ! {"foldlevel", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_foldlevel}, {"foldtext", 0, 0, 0, NULL, ret_string, f_foldtext}, ! {"foldtextresult", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, f_foldtextresult}, {"foreground", 0, 0, 0, NULL, ret_void, f_foreground}, *************** *** 968,974 **** ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, NULL, ret_any, f_getbufvar}, ! {"getchangelist", 0, 1, FEARG_1, NULL, ret_list_any, f_getchangelist}, {"getchar", 0, 1, 0, NULL, ret_any, f_getchar}, --- 1015,1021 ---- ret_list_string, f_getbufline}, {"getbufvar", 2, 3, FEARG_1, NULL, ret_any, f_getbufvar}, ! {"getchangelist", 0, 1, FEARG_1, arg1_string_or_nr, ret_list_any, f_getchangelist}, {"getchar", 0, 1, 0, NULL, ret_any, f_getchar}, *************** *** 996,1012 **** ret_list_number, f_getcursorcharpos}, {"getcwd", 0, 2, FEARG_1, arg2_number, ret_string, f_getcwd}, ! {"getenv", 1, 1, FEARG_1, NULL, ret_any, f_getenv}, ! {"getfontname", 0, 1, 0, NULL, ret_string, f_getfontname}, ! {"getfperm", 1, 1, FEARG_1, NULL, ret_string, f_getfperm}, ! {"getfsize", 1, 1, FEARG_1, NULL, ret_number, f_getfsize}, ! {"getftime", 1, 1, FEARG_1, NULL, ret_number, f_getftime}, ! {"getftype", 1, 1, FEARG_1, NULL, ret_string, f_getftype}, {"getimstatus", 0, 0, 0, NULL, ret_number_bool, f_getimstatus}, --- 1043,1059 ---- ret_list_number, f_getcursorcharpos}, {"getcwd", 0, 2, FEARG_1, arg2_number, ret_string, f_getcwd}, ! {"getenv", 1, 1, FEARG_1, arg1_string, ret_any, f_getenv}, ! {"getfontname", 0, 1, 0, arg1_string, ret_string, f_getfontname}, ! {"getfperm", 1, 1, FEARG_1, arg1_string, ret_string, f_getfperm}, ! {"getfsize", 1, 1, FEARG_1, arg1_string, ret_number, f_getfsize}, ! {"getftime", 1, 1, FEARG_1, arg1_string, ret_number, f_getftime}, ! {"getftype", 1, 1, FEARG_1, arg1_string, ret_string, f_getftype}, {"getimstatus", 0, 0, 0, NULL, ret_number_bool, f_getimstatus}, *************** *** 1016,1022 **** ret_f_getline, f_getline}, {"getloclist", 1, 2, 0, NULL, ret_list_or_dict_1, f_getloclist}, ! {"getmarklist", 0, 1, FEARG_1, NULL, ret_list_dict_any, f_getmarklist}, {"getmatches", 0, 1, 0, arg1_number, ret_list_dict_any, f_getmatches}, --- 1063,1069 ---- ret_f_getline, f_getline}, {"getloclist", 1, 2, 0, NULL, ret_list_or_dict_1, f_getloclist}, ! {"getmarklist", 0, 1, FEARG_1, arg1_string_or_nr, ret_list_dict_any, f_getmarklist}, {"getmatches", 0, 1, 0, arg1_number, ret_list_dict_any, f_getmatches}, *************** *** 1024,1038 **** ret_dict_number, f_getmousepos}, {"getpid", 0, 0, 0, NULL, ret_number, f_getpid}, ! {"getpos", 1, 1, FEARG_1, NULL, ret_list_number, f_getpos}, ! {"getqflist", 0, 1, 0, NULL, ret_list_or_dict_0, f_getqflist}, {"getreg", 0, 3, FEARG_1, NULL, ret_getreg, f_getreg}, ! {"getreginfo", 0, 1, FEARG_1, NULL, ret_dict_any, f_getreginfo}, ! {"getregtype", 0, 1, FEARG_1, NULL, ret_string, f_getregtype}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, --- 1071,1085 ---- ret_dict_number, f_getmousepos}, {"getpid", 0, 0, 0, NULL, ret_number, f_getpid}, ! {"getpos", 1, 1, FEARG_1, arg1_string, ret_list_number, f_getpos}, ! {"getqflist", 0, 1, 0, arg1_dict, 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}, ! {"getregtype", 0, 1, FEARG_1, arg1_string, ret_string, f_getregtype}, {"gettabinfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_gettabinfo}, *************** *** 1042,1048 **** ret_any, f_gettabwinvar}, {"gettagstack", 0, 1, FEARG_1, arg1_number, ret_dict_any, f_gettagstack}, ! {"gettext", 1, 1, FEARG_1, NULL, ret_string, f_gettext}, {"getwininfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_getwininfo}, --- 1089,1095 ---- ret_any, f_gettabwinvar}, {"gettagstack", 0, 1, FEARG_1, arg1_number, ret_dict_any, f_gettagstack}, ! {"gettext", 1, 1, FEARG_1, arg1_string, ret_string, f_gettext}, {"getwininfo", 0, 1, FEARG_1, arg1_number, ret_list_dict_any, f_getwininfo}, *************** *** 1056,1062 **** ret_any, f_getwinvar}, {"glob", 1, 4, FEARG_1, NULL, ret_any, f_glob}, ! {"glob2regpat", 1, 1, FEARG_1, NULL, ret_string, f_glob2regpat}, {"globpath", 2, 5, FEARG_2, NULL, ret_any, f_globpath}, --- 1103,1109 ---- 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}, *************** *** 1072,1092 **** ret_number, f_hlID}, {"highlight_exists",1, 1, FEARG_1, NULL, // obsolete ret_number_bool, f_hlexists}, ! {"histadd", 2, 2, FEARG_2, NULL, ret_number_bool, f_histadd}, {"histdel", 1, 2, FEARG_1, NULL, ret_number_bool, f_histdel}, {"histget", 1, 2, FEARG_1, NULL, ret_string, f_histget}, ! {"histnr", 1, 1, FEARG_1, NULL, ret_number, f_histnr}, ! {"hlID", 1, 1, FEARG_1, NULL, ret_number, f_hlID}, ! {"hlexists", 1, 1, FEARG_1, NULL, ret_number_bool, f_hlexists}, {"hostname", 0, 0, 0, NULL, ret_string, f_hostname}, ! {"iconv", 3, 3, FEARG_1, NULL, ret_string, f_iconv}, {"indent", 1, 1, FEARG_1, NULL, ret_number, f_indent}, --- 1119,1139 ---- ret_number, f_hlID}, {"highlight_exists",1, 1, FEARG_1, NULL, // obsolete ret_number_bool, f_hlexists}, ! {"histadd", 2, 2, FEARG_2, arg2_string, ret_number_bool, f_histadd}, {"histdel", 1, 2, FEARG_1, NULL, ret_number_bool, f_histdel}, {"histget", 1, 2, FEARG_1, NULL, ret_string, f_histget}, ! {"histnr", 1, 1, FEARG_1, arg1_string, ret_number, f_histnr}, ! {"hlID", 1, 1, FEARG_1, arg1_string, ret_number, f_hlID}, ! {"hlexists", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_hlexists}, {"hostname", 0, 0, 0, NULL, ret_string, f_hostname}, ! {"iconv", 3, 3, FEARG_1, arg3_string, ret_string, f_iconv}, {"indent", 1, 1, FEARG_1, NULL, ret_number, f_indent}, *************** *** 1096,1108 **** ret_string, f_input}, {"inputdialog", 1, 3, FEARG_1, NULL, ret_string, f_inputdialog}, ! {"inputlist", 1, 1, FEARG_1, NULL, ret_number, f_inputlist}, {"inputrestore", 0, 0, 0, NULL, ret_number_bool, f_inputrestore}, {"inputsave", 0, 0, 0, NULL, ret_number_bool, f_inputsave}, ! {"inputsecret", 1, 2, FEARG_1, NULL, ret_string, f_inputsecret}, {"insert", 2, 3, FEARG_1, arg3_insert, ret_first_arg, f_insert}, --- 1143,1155 ---- ret_string, f_input}, {"inputdialog", 1, 3, FEARG_1, NULL, ret_string, f_inputdialog}, ! {"inputlist", 1, 1, FEARG_1, arg1_string_list, ret_number, f_inputlist}, {"inputrestore", 0, 0, 0, NULL, ret_number_bool, f_inputrestore}, {"inputsave", 0, 0, 0, NULL, ret_number_bool, f_inputsave}, ! {"inputsecret", 1, 2, FEARG_1, arg2_string, ret_string, f_inputsecret}, {"insert", 2, 3, FEARG_1, arg3_insert, ret_first_arg, f_insert}, *************** *** 1110,1116 **** ret_void, f_interrupt}, {"invert", 1, 1, FEARG_1, arg1_number, ret_number, f_invert}, ! {"isdirectory", 1, 1, FEARG_1, NULL, ret_number_bool, f_isdirectory}, {"isinf", 1, 1, FEARG_1, arg1_float_or_nr, ret_number, MATH_FUNC(f_isinf)}, --- 1157,1163 ---- ret_void, f_interrupt}, {"invert", 1, 1, FEARG_1, arg1_number, ret_number, f_invert}, ! {"isdirectory", 1, 1, FEARG_1, arg1_string, ret_number_bool, f_isdirectory}, {"isinf", 1, 1, FEARG_1, arg1_float_or_nr, ret_number, MATH_FUNC(f_isinf)}, *************** *** 1118,1124 **** ret_number_bool, f_islocked}, {"isnan", 1, 1, FEARG_1, arg1_float_or_nr, ret_number_bool, MATH_FUNC(f_isnan)}, ! {"items", 1, 1, FEARG_1, NULL, ret_list_any, f_items}, {"job_getchannel", 1, 1, FEARG_1, NULL, ret_channel, JOB_FUNC(f_job_getchannel)}, --- 1165,1171 ---- ret_number_bool, f_islocked}, {"isnan", 1, 1, FEARG_1, arg1_float_or_nr, ret_number_bool, MATH_FUNC(f_isnan)}, ! {"items", 1, 1, FEARG_1, arg1_dict, ret_list_any, f_items}, {"job_getchannel", 1, 1, FEARG_1, NULL, ret_channel, JOB_FUNC(f_job_getchannel)}, *************** *** 1134,1148 **** ret_number_bool, JOB_FUNC(f_job_stop)}, {"join", 1, 2, FEARG_1, NULL, ret_string, f_join}, ! {"js_decode", 1, 1, FEARG_1, NULL, ret_any, f_js_decode}, {"js_encode", 1, 1, FEARG_1, NULL, ret_string, f_js_encode}, ! {"json_decode", 1, 1, FEARG_1, NULL, ret_any, f_json_decode}, {"json_encode", 1, 1, FEARG_1, NULL, ret_string, f_json_encode}, ! {"keys", 1, 1, FEARG_1, NULL, ret_list_string, f_keys}, {"last_buffer_nr", 0, 0, 0, NULL, // obsolete ret_number, f_last_buffer_nr}, --- 1181,1195 ---- 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}, {"js_encode", 1, 1, FEARG_1, NULL, ret_string, f_js_encode}, ! {"json_decode", 1, 1, FEARG_1, arg1_string, ret_any, f_json_decode}, {"json_encode", 1, 1, FEARG_1, NULL, ret_string, f_json_encode}, ! {"keys", 1, 1, FEARG_1, arg1_dict, ret_list_string, f_keys}, {"last_buffer_nr", 0, 0, 0, NULL, // obsolete ret_number, f_last_buffer_nr}, *************** *** 1154,1162 **** ret_number, f_libcallnr}, {"line", 1, 2, FEARG_1, NULL, ret_number, f_line}, ! {"line2byte", 1, 1, FEARG_1, NULL, ret_number, f_line2byte}, ! {"lispindent", 1, 1, FEARG_1, NULL, ret_number, f_lispindent}, {"list2str", 1, 2, FEARG_1, NULL, ret_string, f_list2str}, --- 1201,1209 ---- ret_number, f_libcallnr}, {"line", 1, 2, FEARG_1, NULL, 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}, *************** *** 1214,1220 **** ret_list_any, f_matchstrpos}, {"max", 1, 1, FEARG_1, NULL, ret_number, f_max}, ! {"menu_info", 1, 2, FEARG_1, NULL, ret_dict_any, #ifdef FEAT_MENU f_menu_info --- 1261,1267 ---- ret_list_any, f_matchstrpos}, {"max", 1, 1, FEARG_1, NULL, ret_number, f_max}, ! {"menu_info", 1, 2, FEARG_1, arg2_string, ret_dict_any, #ifdef FEAT_MENU f_menu_info *************** *** 1236,1242 **** NULL #endif }, ! {"nextnonblank", 1, 1, FEARG_1, NULL, ret_number, f_nextnonblank}, {"nr2char", 1, 2, FEARG_1, NULL, ret_string, f_nr2char}, --- 1283,1289 ---- NULL #endif }, ! {"nextnonblank", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_nextnonblank}, {"nr2char", 1, 2, FEARG_1, NULL, ret_string, f_nr2char}, *************** *** 1296,1306 **** ret_void, PROP_FUNC(f_popup_show)}, {"pow", 2, 2, FEARG_1, arg2_float_or_nr, ret_float, FLOAT_FUNC(f_pow)}, ! {"prevnonblank", 1, 1, FEARG_1, NULL, ret_number, f_prevnonblank}, {"printf", 1, 19, FEARG_2, NULL, ret_string, f_printf}, ! {"prompt_getprompt", 1, 1, FEARG_1, NULL, ret_string, JOB_FUNC(f_prompt_getprompt)}, {"prompt_setcallback", 2, 2, FEARG_1, NULL, ret_void, JOB_FUNC(f_prompt_setcallback)}, --- 1343,1353 ---- ret_void, PROP_FUNC(f_popup_show)}, {"pow", 2, 2, FEARG_1, arg2_float_or_nr, ret_float, FLOAT_FUNC(f_pow)}, ! {"prevnonblank", 1, 1, FEARG_1, arg1_string_or_nr, ret_number, f_prevnonblank}, {"printf", 1, 19, FEARG_2, NULL, ret_string, f_printf}, ! {"prompt_getprompt", 1, 1, FEARG_1, arg1_string_or_nr, ret_string, JOB_FUNC(f_prompt_getprompt)}, {"prompt_setcallback", 2, 2, FEARG_1, NULL, ret_void, JOB_FUNC(f_prompt_setcallback)}, *************** *** 1356,1366 **** NULL #endif }, ! {"rand", 0, 1, FEARG_1, NULL, ret_number, f_rand}, {"range", 1, 3, FEARG_1, NULL, ret_list_number, f_range}, ! {"readblob", 1, 1, FEARG_1, NULL, ret_blob, f_readblob}, {"readdir", 1, 3, FEARG_1, NULL, ret_list_string, f_readdir}, --- 1403,1413 ---- NULL #endif }, ! {"rand", 0, 1, FEARG_1, arg1_list_number, ret_number, f_rand}, {"range", 1, 3, FEARG_1, NULL, ret_list_number, f_range}, ! {"readblob", 1, 1, FEARG_1, arg1_string, ret_blob, f_readblob}, {"readdir", 1, 3, FEARG_1, NULL, ret_list_string, f_readdir}, *************** *** 1374,1388 **** ret_string, f_reg_executing}, {"reg_recording", 0, 0, 0, NULL, ret_string, f_reg_recording}, ! {"reltime", 0, 2, FEARG_1, NULL, ret_list_any, f_reltime}, ! {"reltimefloat", 1, 1, FEARG_1, NULL, ret_float, FLOAT_FUNC(f_reltimefloat)}, ! {"reltimestr", 1, 1, FEARG_1, NULL, ret_string, f_reltimestr}, {"remote_expr", 2, 4, FEARG_1, NULL, ret_string, f_remote_expr}, ! {"remote_foreground", 1, 1, FEARG_1, NULL, ret_string, f_remote_foreground}, {"remote_peek", 1, 2, FEARG_1, NULL, ret_number, f_remote_peek}, --- 1421,1435 ---- ret_string, f_reg_executing}, {"reg_recording", 0, 0, 0, NULL, ret_string, f_reg_recording}, ! {"reltime", 0, 2, FEARG_1, arg2_list_number, 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, 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, NULL, ret_number, f_remote_peek}, *************** *** 1390,1404 **** ret_string, f_remote_read}, {"remote_send", 2, 3, FEARG_1, NULL, ret_string, f_remote_send}, ! {"remote_startserver", 1, 1, FEARG_1, NULL, ret_void, f_remote_startserver}, {"remove", 2, 3, FEARG_1, NULL, ret_remove, f_remove}, ! {"rename", 2, 2, FEARG_1, NULL, ret_number_bool, f_rename}, {"repeat", 2, 2, FEARG_1, NULL, ret_first_arg, f_repeat}, ! {"resolve", 1, 1, FEARG_1, NULL, ret_string, f_resolve}, {"reverse", 1, 1, FEARG_1, NULL, ret_first_arg, f_reverse}, --- 1437,1451 ---- 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}, {"repeat", 2, 2, FEARG_1, NULL, ret_first_arg, f_repeat}, ! {"resolve", 1, 1, FEARG_1, arg1_string, ret_string, f_resolve}, {"reverse", 1, 1, FEARG_1, NULL, ret_first_arg, f_reverse}, *************** *** 1420,1426 **** ret_list_number, f_screenchars}, {"screencol", 0, 0, 0, NULL, ret_number, f_screencol}, ! {"screenpos", 3, 3, FEARG_1, NULL, ret_dict_number, f_screenpos}, {"screenrow", 0, 0, 0, NULL, ret_number, f_screenrow}, --- 1467,1473 ---- ret_list_number, f_screenchars}, {"screencol", 0, 0, 0, NULL, ret_number, f_screencol}, ! {"screenpos", 3, 3, FEARG_1, arg3_number, ret_dict_number, f_screenpos}, {"screenrow", 0, 0, 0, NULL, ret_number, f_screenrow}, *************** *** 1428,1434 **** ret_string, f_screenstring}, {"search", 1, 5, FEARG_1, NULL, ret_number, f_search}, ! {"searchcount", 0, 1, FEARG_1, NULL, ret_dict_any, f_searchcount}, {"searchdecl", 1, 3, FEARG_1, NULL, ret_number_bool, f_searchdecl}, --- 1475,1481 ---- ret_string, f_screenstring}, {"search", 1, 5, FEARG_1, NULL, ret_number, f_search}, ! {"searchcount", 0, 1, FEARG_1, arg1_dict, ret_dict_any, f_searchcount}, {"searchdecl", 1, 3, FEARG_1, NULL, ret_number_bool, f_searchdecl}, *************** *** 1450,1456 **** ret_void, f_setcellwidths}, {"setcharpos", 2, 2, FEARG_2, NULL, ret_number_bool, f_setcharpos}, ! {"setcharsearch", 1, 1, FEARG_1, NULL, ret_void, f_setcharsearch}, {"setcmdpos", 1, 1, FEARG_1, arg1_number, ret_number_bool, f_setcmdpos}, --- 1497,1503 ---- ret_void, f_setcellwidths}, {"setcharpos", 2, 2, FEARG_2, NULL, ret_number_bool, f_setcharpos}, ! {"setcharsearch", 1, 1, FEARG_1, arg1_dict, ret_void, f_setcharsearch}, {"setcmdpos", 1, 1, FEARG_1, arg1_number, ret_number_bool, f_setcmdpos}, *************** *** 1458,1464 **** ret_number_bool, f_setcursorcharpos}, {"setenv", 2, 2, FEARG_2, NULL, ret_void, f_setenv}, ! {"setfperm", 2, 2, FEARG_1, NULL, ret_number_bool, f_setfperm}, {"setline", 2, 2, FEARG_2, NULL, ret_number_bool, f_setline}, --- 1505,1511 ---- ret_number_bool, f_setcursorcharpos}, {"setenv", 2, 2, FEARG_2, NULL, ret_void, f_setenv}, ! {"setfperm", 2, 2, FEARG_1, arg2_string, ret_number_bool, f_setfperm}, {"setline", 2, 2, FEARG_2, NULL, ret_number_bool, f_setline}, *************** *** 1480,1486 **** ret_number_bool, f_settagstack}, {"setwinvar", 3, 3, FEARG_3, NULL, ret_void, f_setwinvar}, ! {"sha256", 1, 1, FEARG_1, NULL, ret_string, #ifdef FEAT_CRYPT f_sha256 --- 1527,1533 ---- ret_number_bool, f_settagstack}, {"setwinvar", 3, 3, FEARG_3, NULL, ret_void, f_setwinvar}, ! {"sha256", 1, 1, FEARG_1, arg1_string, ret_string, #ifdef FEAT_CRYPT f_sha256 *************** *** 1510,1516 **** ret_number_bool, SIGN_FUNC(f_sign_unplace)}, {"sign_unplacelist", 1, 2, FEARG_1, NULL, ret_list_number, SIGN_FUNC(f_sign_unplacelist)}, ! {"simplify", 1, 1, FEARG_1, NULL, ret_string, f_simplify}, {"sin", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sin)}, --- 1557,1563 ---- ret_number_bool, SIGN_FUNC(f_sign_unplace)}, {"sign_unplacelist", 1, 2, FEARG_1, NULL, ret_list_number, SIGN_FUNC(f_sign_unplacelist)}, ! {"simplify", 1, 1, FEARG_1, arg1_string, ret_string, f_simplify}, {"sin", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sin)}, *************** *** 1526,1536 **** ret_number, SOUND_FUNC(f_sound_playevent)}, {"sound_playfile", 1, 2, FEARG_1, NULL, ret_number, SOUND_FUNC(f_sound_playfile)}, ! {"sound_stop", 1, 1, FEARG_1, NULL, ret_void, SOUND_FUNC(f_sound_stop)}, ! {"soundfold", 1, 1, FEARG_1, NULL, ret_string, f_soundfold}, ! {"spellbadword", 0, 1, FEARG_1, NULL, ret_list_string, f_spellbadword}, {"spellsuggest", 1, 3, FEARG_1, NULL, ret_list_string, f_spellsuggest}, --- 1573,1583 ---- ret_number, SOUND_FUNC(f_sound_playevent)}, {"sound_playfile", 1, 2, FEARG_1, NULL, ret_number, SOUND_FUNC(f_sound_playfile)}, ! {"sound_stop", 1, 1, FEARG_1, arg1_number, ret_void, SOUND_FUNC(f_sound_stop)}, ! {"soundfold", 1, 1, FEARG_1, arg1_string, 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}, *************** *** 1538,1546 **** ret_list_string, f_split}, {"sqrt", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sqrt)}, ! {"srand", 0, 1, FEARG_1, NULL, ret_list_number, f_srand}, ! {"state", 0, 1, FEARG_1, NULL, ret_string, f_state}, {"str2float", 1, 1, FEARG_1, arg1_string, ret_float, FLOAT_FUNC(f_str2float)}, --- 1585,1593 ---- ret_list_string, f_split}, {"sqrt", 1, 1, FEARG_1, arg1_float_or_nr, ret_float, FLOAT_FUNC(f_sqrt)}, ! {"srand", 0, 1, FEARG_1, arg1_number, ret_list_number, f_srand}, ! {"state", 0, 1, FEARG_1, arg1_string, ret_string, f_state}, {"str2float", 1, 1, FEARG_1, arg1_string, ret_float, FLOAT_FUNC(f_str2float)}, *************** *** 1570,1580 **** ret_number, f_stridx}, {"string", 1, 1, FEARG_1, NULL, ret_string, f_string}, ! {"strlen", 1, 1, FEARG_1, NULL, ret_number, f_strlen}, {"strpart", 2, 4, FEARG_1, NULL, ret_string, f_strpart}, ! {"strptime", 2, 2, FEARG_1, NULL, ret_number, #ifdef HAVE_STRPTIME f_strptime --- 1617,1627 ---- ret_number, f_stridx}, {"string", 1, 1, FEARG_1, NULL, 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, #ifdef HAVE_STRPTIME f_strptime *************** *** 1584,1606 **** }, {"strridx", 2, 3, FEARG_1, NULL, ret_number, f_strridx}, ! {"strtrans", 1, 1, FEARG_1, NULL, ret_string, f_strtrans}, ! {"strwidth", 1, 1, FEARG_1, NULL, ret_number, f_strwidth}, {"submatch", 1, 2, FEARG_1, NULL, ret_string, f_submatch}, {"substitute", 4, 4, FEARG_1, NULL, ret_string, f_substitute}, ! {"swapinfo", 1, 1, FEARG_1, NULL, ret_dict_any, f_swapinfo}, ! {"swapname", 1, 1, FEARG_1, NULL, ret_string, f_swapname}, {"synID", 3, 3, 0, NULL, ret_number, f_synID}, {"synIDattr", 2, 3, FEARG_1, NULL, ret_string, f_synIDattr}, ! {"synIDtrans", 1, 1, FEARG_1, NULL, ret_number, f_synIDtrans}, {"synconcealed", 2, 2, 0, NULL, ret_list_any, f_synconcealed}, --- 1631,1653 ---- }, {"strridx", 2, 3, FEARG_1, NULL, ret_number, f_strridx}, ! {"strtrans", 1, 1, FEARG_1, arg1_string, 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}, ! {"swapinfo", 1, 1, FEARG_1, arg1_string, 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}, ! {"synIDtrans", 1, 1, FEARG_1, arg1_number, ret_number, f_synIDtrans}, {"synconcealed", 2, 2, 0, NULL, ret_list_any, f_synconcealed}, *************** *** 1610,1618 **** ret_string, f_system}, {"systemlist", 1, 2, FEARG_1, NULL, ret_list_string, f_systemlist}, ! {"tabpagebuflist", 0, 1, FEARG_1, NULL, ret_list_number, f_tabpagebuflist}, ! {"tabpagenr", 0, 1, 0, NULL, ret_number, f_tabpagenr}, {"tabpagewinnr", 1, 2, FEARG_1, NULL, ret_number, f_tabpagewinnr}, --- 1657,1665 ---- ret_string, f_system}, {"systemlist", 1, 2, FEARG_1, NULL, ret_list_string, f_systemlist}, ! {"tabpagebuflist", 0, 1, FEARG_1, arg1_number, ret_list_number, f_tabpagebuflist}, ! {"tabpagenr", 0, 1, 0, arg1_string, ret_number, f_tabpagenr}, {"tabpagewinnr", 1, 2, FEARG_1, NULL, ret_number, f_tabpagewinnr}, *************** *** 1746,1758 **** ret_any, f_test_unknown}, {"test_void", 0, 0, 0, NULL, ret_void, f_test_void}, ! {"timer_info", 0, 1, FEARG_1, NULL, 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)}, ! {"timer_stop", 1, 1, FEARG_1, NULL, ret_void, TIMER_FUNC(f_timer_stop)}, {"timer_stopall", 0, 0, 0, NULL, ret_void, TIMER_FUNC(f_timer_stopall)}, --- 1793,1805 ---- ret_any, f_test_unknown}, {"test_void", 0, 0, 0, NULL, 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)}, ! {"timer_stop", 1, 1, FEARG_1, arg1_number, ret_void, TIMER_FUNC(f_timer_stop)}, {"timer_stopall", 0, 0, 0, NULL, ret_void, TIMER_FUNC(f_timer_stopall)}, *************** *** 1770,1782 **** ret_number, f_type}, {"typename", 1, 1, FEARG_1, NULL, ret_string, f_typename}, ! {"undofile", 1, 1, FEARG_1, NULL, ret_string, f_undofile}, {"undotree", 0, 0, 0, NULL, ret_dict_any, f_undotree}, {"uniq", 1, 3, FEARG_1, NULL, ret_list_any, f_uniq}, ! {"values", 1, 1, FEARG_1, NULL, ret_list_any, f_values}, {"virtcol", 1, 1, FEARG_1, NULL, ret_number, f_virtcol}, --- 1817,1829 ---- ret_number, f_type}, {"typename", 1, 1, FEARG_1, NULL, ret_string, f_typename}, ! {"undofile", 1, 1, FEARG_1, arg1_string, ret_string, f_undofile}, {"undotree", 0, 0, 0, NULL, ret_dict_any, f_undotree}, {"uniq", 1, 3, FEARG_1, NULL, ret_list_any, f_uniq}, ! {"values", 1, 1, FEARG_1, arg1_dict, ret_list_any, f_values}, {"virtcol", 1, 1, FEARG_1, NULL, ret_number, f_virtcol}, *************** *** 1786,1794 **** ret_number, f_wildmenumode}, {"win_execute", 2, 3, FEARG_2, NULL, ret_string, f_win_execute}, ! {"win_findbuf", 1, 1, FEARG_1, NULL, ret_list_number, f_win_findbuf}, ! {"win_getid", 0, 2, FEARG_1, NULL, ret_number, f_win_getid}, {"win_gettype", 0, 1, FEARG_1, arg1_number, ret_string, f_win_gettype}, --- 1833,1841 ---- ret_number, f_wildmenumode}, {"win_execute", 2, 3, FEARG_2, NULL, ret_string, f_win_execute}, ! {"win_findbuf", 1, 1, FEARG_1, arg1_number, ret_list_number, f_win_findbuf}, ! {"win_getid", 0, 2, FEARG_1, arg2_number, ret_number, f_win_getid}, {"win_gettype", 0, 1, FEARG_1, arg1_number, ret_string, f_win_gettype}, *************** *** 1814,1824 **** ret_list_any, f_winlayout}, {"winline", 0, 0, 0, NULL, ret_number, f_winline}, ! {"winnr", 0, 1, FEARG_1, NULL, ret_number, f_winnr}, {"winrestcmd", 0, 0, 0, NULL, ret_string, f_winrestcmd}, ! {"winrestview", 1, 1, FEARG_1, NULL, ret_void, f_winrestview}, {"winsaveview", 0, 0, 0, NULL, ret_dict_number, f_winsaveview}, --- 1861,1871 ---- ret_list_any, f_winlayout}, {"winline", 0, 0, 0, NULL, ret_number, f_winline}, ! {"winnr", 0, 1, FEARG_1, arg1_string, ret_number, f_winnr}, {"winrestcmd", 0, 0, 0, NULL, ret_string, f_winrestcmd}, ! {"winrestview", 1, 1, FEARG_1, arg1_dict, ret_void, f_winrestview}, {"winsaveview", 0, 0, 0, NULL, ret_dict_number, f_winsaveview}, *** ../vim-8.2.3083/src/testdir/test_functions.vim 2021-07-02 20:19:27.964669621 +0200 --- src/testdir/test_functions.vim 2021-07-03 11:53:01.558586873 +0200 *************** *** 169,175 **** if has('float') call assert_equal(3, strwidth(1.2)) ! call CheckDefExecAndScriptFailure(['echo strwidth(1.2)'], 'E806:') endif set ambiwidth& --- 169,176 ---- if has('float') call assert_equal(3, strwidth(1.2)) ! call CheckDefFailure(['echo strwidth(1.2)'], 'E1013:') ! call CheckScriptFailure(['vim9script', 'echo strwidth(1.2)'], 'E806:') endif set ambiwidth& *************** *** 236,242 **** call assert_fails('call str2nr({->2})', 'E729:') if has('float') call assert_equal(1, str2nr(1.2)) ! call CheckDefExecFailure(['echo str2nr(1.2)'], 'E1013:') call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:') endif call assert_fails('call str2nr(10, [])', 'E745:') --- 237,243 ---- call assert_fails('call str2nr({->2})', 'E729:') if has('float') call assert_equal(1, str2nr(1.2)) ! call CheckDefFailure(['echo str2nr(1.2)'], 'E1013:') call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:') endif call assert_fails('call str2nr(10, [])', 'E745:') *************** *** 499,505 **** call assert_fails('call simplify({})', 'E731:') if has('float') call assert_equal('1.2', simplify(1.2)) ! call CheckDefExecAndScriptFailure(['echo simplify(1.2)'], 'E806:') endif endfunc --- 500,507 ---- call assert_fails('call simplify({})', 'E731:') if has('float') call assert_equal('1.2', simplify(1.2)) ! call CheckDefFailure(['echo simplify(1.2)'], 'E1013:') ! call CheckScriptFailure(['vim9script', 'echo simplify(1.2)'], 'E806:') endif endfunc *** ../vim-8.2.3083/src/testdir/test_glob2regpat.vim 2021-06-06 14:14:35.352774336 +0200 --- src/testdir/test_glob2regpat.vim 2021-07-03 11:53:01.558586873 +0200 *************** *** 5,11 **** func Test_glob2regpat_invalid() if has('float') call assert_equal('^1\.33$', glob2regpat(1.33)) ! call CheckDefExecAndScriptFailure(['echo glob2regpat(1.33)'], 'E806:') endif call assert_fails('call glob2regpat("}")', 'E219:') call assert_fails('call glob2regpat("{")', 'E220:') --- 5,12 ---- func Test_glob2regpat_invalid() if has('float') call assert_equal('^1\.33$', glob2regpat(1.33)) ! call CheckDefFailure(['echo glob2regpat(1.2)'], 'E1013:') ! call CheckScriptFailure(['vim9script', 'echo glob2regpat(1.2)'], 'E806:') endif call assert_fails('call glob2regpat("}")', 'E219:') call assert_fails('call glob2regpat("{")', 'E220:') *** ../vim-8.2.3083/src/testdir/test_vim9_builtin.vim 2021-06-22 19:52:23.901800877 +0200 --- src/testdir/test_vim9_builtin.vim 2021-07-03 11:53:01.558586873 +0200 *************** *** 180,191 **** --- 180,193 ---- CheckGui CheckFeature balloon_eval + assert_fails('balloon_show(10)', 'E1174:') assert_fails('balloon_show(true)', 'E1174:') enddef def Test_balloon_split() CheckFeature balloon_eval_term + assert_fails('balloon_split([])', 'E1174:') assert_fails('balloon_split(true)', 'E1174:') enddef *************** *** 206,219 **** CheckDefExecAndScriptFailure(lines, 'E1174: String required for argument 4') enddef def Test_bufexists() ! assert_fails('bufexists(true)', 'E1174') enddef def Test_buflisted() var res: bool = buflisted('asdf') assert_equal(false, res) ! assert_fails('buflisted(true)', 'E1174') enddef def Test_bufname() --- 208,235 ---- CheckDefExecAndScriptFailure(lines, 'E1174: String required for argument 4') enddef + def Test_bufadd() + assert_fails('bufadd([])', 'E730:') + enddef + def Test_bufexists() ! assert_fails('bufexists(true)', 'E1174:') enddef def Test_buflisted() var res: bool = buflisted('asdf') assert_equal(false, res) ! assert_fails('buflisted(true)', 'E1174:') ! assert_fails('buflisted([])', 'E1174:') ! enddef ! ! def Test_bufload() ! assert_fails('bufload([])', 'E730:') ! enddef ! ! def Test_bufloaded() ! assert_fails('bufloaded(true)', 'E1174:') ! assert_fails('bufloaded([])', 'E1174:') enddef def Test_bufname() *************** *** 222,227 **** --- 238,245 ---- edit OtherFile bufname('#')->assert_equal('SomeFile') close + assert_fails('bufname(true)', 'E1138:') + assert_fails('bufname([])', 'E745:') enddef def Test_bufnr() *************** *** 246,252 **** bwipe SomeFile bwipe OtherFile ! assert_fails('bufwinid(true)', 'E1138') enddef def Test_call_call() --- 264,282 ---- bwipe SomeFile bwipe OtherFile ! assert_fails('bufwinid(true)', 'E1138:') ! assert_fails('bufwinid([])', 'E745:') ! enddef ! ! def Test_bufwinnr() ! assert_fails('bufwinnr(true)', 'E1138:') ! assert_fails('bufwinnr([])', 'E745:') ! enddef ! ! def Test_byte2line() ! CheckDefFailure(['byte2line("1")'], 'E1013: Argument 1: type mismatch, expected number but got string') ! CheckDefFailure(['byte2line([])'], 'E1013: Argument 1: type mismatch, expected number but got list') ! assert_equal(-1, byte2line(0)) enddef def Test_call_call() *************** *** 259,280 **** if !has('channel') CheckFeature channel endif ! assert_fails('ch_logfile(true)', 'E1174') ! assert_fails('ch_logfile("foo", true)', 'E1174') enddef def Test_char2nr() char2nr('あ', true)->assert_equal(12354) ! assert_fails('char2nr(true)', 'E1174') enddef def Test_charclass() ! assert_fails('charclass(true)', 'E1174') enddef def Test_chdir() ! assert_fails('chdir(true)', 'E1174') enddef def Test_clearmatches() --- 289,317 ---- if !has('channel') CheckFeature channel endif ! assert_fails('ch_logfile(true)', 'E1174:') ! assert_fails('ch_logfile("foo", true)', 'E1174:') enddef def Test_char2nr() char2nr('あ', true)->assert_equal(12354) ! assert_fails('char2nr(true)', 'E1174:') enddef def Test_charclass() ! assert_fails('charclass(true)', 'E1174:') enddef def Test_chdir() ! assert_fails('chdir(true)', 'E1174:') ! enddef ! ! def Test_cindent() ! CheckDefFailure(['cindent([])'], 'E1013: Argument 1: type mismatch, expected string but got list') ! CheckDefFailure(['cindent(null)'], 'E1013: Argument 1: type mismatch, expected string but got special') ! assert_equal(-1, cindent(0)) ! assert_equal(0, cindent('.')) enddef def Test_clearmatches() *************** *** 286,292 **** setline(1, 'asdf') col([1, '$'])->assert_equal(5) ! assert_fails('col(true)', 'E1174') enddef def Test_confirm() --- 323,329 ---- setline(1, 'asdf') col([1, '$'])->assert_equal(5) ! assert_fails('col(true)', 'E1174:') enddef def Test_confirm() *************** *** 294,302 **** CheckFeature dialog_con endif ! assert_fails('confirm(true)', 'E1174') ! assert_fails('confirm("yes", true)', 'E1174') ! assert_fails('confirm("yes", "maybe", 2, true)', 'E1174') enddef def Test_copy_return_type() --- 331,346 ---- CheckFeature dialog_con endif ! assert_fails('confirm(true)', 'E1174:') ! assert_fails('confirm("yes", true)', 'E1174:') ! assert_fails('confirm("yes", "maybe", 2, true)', 'E1174:') ! 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') ! assert_equal({'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}, complete_info()) ! assert_equal({'mode': '', 'items': []}, complete_info(['mode', 'items'])) enddef def Test_copy_return_type() *************** *** 346,357 **** assert_equal(true, res) enddef def Test_executable() assert_false(executable("")) assert_false(executable(test_null_string())) ! CheckDefExecFailure(['echo executable(123)'], 'E1174:') ! CheckDefExecFailure(['echo executable(true)'], 'E1174:') enddef def Test_execute() --- 390,421 ---- assert_equal(true, res) 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') + assert_equal(0, diff_filler(1)) + assert_equal(0, diff_filler('.')) + enddef + + def Test_escape() + CheckDefFailure(['escape("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number') + CheckDefFailure(['escape(10, " ")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['escape(true, false)'], 'E1013: Argument 1: type mismatch, expected string but got bool') + assert_equal('a\:b', escape("a:b", ":")) + enddef + + def Test_eval() + CheckDefFailure(['eval(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['eval(null)'], 'E1013: Argument 1: type mismatch, expected string but got special') + assert_equal(2, eval('1 + 1')) + enddef + def Test_executable() assert_false(executable("")) assert_false(executable(test_null_string())) ! CheckDefExecFailure(['echo executable(123)'], 'E1013:') ! CheckDefExecFailure(['echo executable(true)'], 'E1013:') enddef def Test_execute() *************** *** 367,377 **** enddef def Test_exepath() ! CheckDefExecFailure(['echo exepath(true)'], 'E1174:') ! CheckDefExecFailure(['echo exepath(v:null)'], 'E1174:') CheckDefExecFailure(['echo exepath("")'], 'E1175:') enddef def Test_expand() split SomeFile expand('%', true, true)->assert_equal(['SomeFile']) --- 431,446 ---- enddef def Test_exepath() ! CheckDefExecFailure(['echo exepath(true)'], 'E1013:') ! CheckDefExecFailure(['echo exepath(v:null)'], 'E1013:') CheckDefExecFailure(['echo exepath("")'], 'E1175:') enddef + def Test_exists() + CheckDefFailure(['exists(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + call assert_equal(1, exists('&tabstop')) + enddef + def Test_expand() split SomeFile expand('%', true, true)->assert_equal(['SomeFile']) *************** *** 507,512 **** --- 576,591 ---- CheckScriptFailure(lines, 'E1001: Variable not found: m') enddef + def Test_feedkeys() + CheckDefFailure(['feedkeys(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['feedkeys("x", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number') + CheckDefFailure(['feedkeys([], {})'], 'E1013: Argument 1: type mismatch, expected string but got list') + g:TestVar = 1 + feedkeys(":g:TestVar = 789\n", 'xt') + assert_equal(789, g:TestVar) + unlet g:TestVar + enddef + def Test_job_info_return_type() if has('job') job_start(&shell) *************** *** 521,536 **** assert_false(filereadable("")) assert_false(filereadable(test_null_string())) ! CheckDefExecFailure(['echo filereadable(123)'], 'E1174:') ! CheckDefExecFailure(['echo filereadable(true)'], 'E1174:') enddef def Test_filewritable() assert_false(filewritable("")) assert_false(filewritable(test_null_string())) ! CheckDefExecFailure(['echo filewritable(123)'], 'E1174:') ! CheckDefExecFailure(['echo filewritable(true)'], 'E1174:') enddef def Test_finddir() --- 600,615 ---- assert_false(filereadable("")) assert_false(filereadable(test_null_string())) ! CheckDefExecFailure(['echo filereadable(123)'], 'E1013:') ! CheckDefExecFailure(['echo filereadable(true)'], 'E1013:') enddef def Test_filewritable() assert_false(filewritable("")) assert_false(filewritable(test_null_string())) ! CheckDefExecFailure(['echo filewritable(123)'], 'E1013:') ! CheckDefExecFailure(['echo filewritable(true)'], 'E1013:') enddef def Test_finddir() *************** *** 620,634 **** CheckDefFailure(['echo trunc("a")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef def Test_fnamemodify() CheckDefSuccess(['echo fnamemodify(test_null_string(), ":p")']) CheckDefSuccess(['echo fnamemodify("", ":p")']) CheckDefSuccess(['echo fnamemodify("file", test_null_string())']) CheckDefSuccess(['echo fnamemodify("file", "")']) ! CheckDefExecFailure(['echo fnamemodify(true, ":p")'], 'E1174: String required for argument 1') ! CheckDefExecFailure(['echo fnamemodify(v:null, ":p")'], 'E1174: String required for argument 1') ! CheckDefExecFailure(['echo fnamemodify("file", true)'], 'E1174: String required for argument 2') enddef def Wrong_dict_key_type(items: list): list --- 699,718 ---- CheckDefFailure(['echo trunc("a")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_fnameescape() + CheckDefFailure(['fnameescape(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal('\+a\%b\|', fnameescape('+a%b|')) + enddef + def Test_fnamemodify() CheckDefSuccess(['echo fnamemodify(test_null_string(), ":p")']) CheckDefSuccess(['echo fnamemodify("", ":p")']) CheckDefSuccess(['echo fnamemodify("file", test_null_string())']) CheckDefSuccess(['echo fnamemodify("file", "")']) ! CheckDefExecFailure(['echo fnamemodify(true, ":p")'], 'E1013: Argument 1: type mismatch, expected string but got bool') ! CheckDefExecFailure(['echo fnamemodify(v:null, ":p")'], 'E1013: Argument 1: type mismatch, expected string but got special') ! CheckDefExecFailure(['echo fnamemodify("file", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool') enddef def Wrong_dict_key_type(items: list): list *************** *** 654,659 **** --- 738,767 ---- res->assert_equal({aa: [1], ac: [3]}) enddef + def Test_foldclosed() + CheckDefFailure(['foldclosed(function("min"))'], 'E1013: Argument 1: type mismatch, expected string but got func(...): any') + assert_equal(-1, foldclosed(1)) + assert_equal(-1, foldclosed('$')) + enddef + + def Test_foldclosedend() + CheckDefFailure(['foldclosedend(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') + assert_equal(-1, foldclosedend(1)) + assert_equal(-1, foldclosedend('w0')) + enddef + + def Test_foldlevel() + CheckDefFailure(['foldlevel(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob') + assert_equal(0, foldlevel(1)) + assert_equal(0, foldlevel('.')) + enddef + + def Test_foldtextresult() + CheckDefFailure(['foldtextresult(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float') + assert_equal('', foldtextresult(1)) + assert_equal('', foldtextresult('.')) + enddef + def Test_fullcommand() assert_equal('next', fullcommand('n')) assert_equal('noremap', fullcommand('no')) *************** *** 762,797 **** d->assert_equal({items: []}) enddef def Test_getfperm() assert_equal('', getfperm("")) assert_equal('', getfperm(test_null_string())) ! CheckDefExecFailure(['echo getfperm(true)'], 'E1174:') ! CheckDefExecFailure(['echo getfperm(v:null)'], 'E1174:') enddef def Test_getfsize() assert_equal(-1, getfsize("")) assert_equal(-1, getfsize(test_null_string())) ! CheckDefExecFailure(['echo getfsize(true)'], 'E1174:') ! CheckDefExecFailure(['echo getfsize(v:null)'], 'E1174:') enddef def Test_getftime() assert_equal(-1, getftime("")) assert_equal(-1, getftime(test_null_string())) ! CheckDefExecFailure(['echo getftime(true)'], 'E1174:') ! CheckDefExecFailure(['echo getftime(v:null)'], 'E1174:') enddef def Test_getftype() assert_equal('', getftype("")) assert_equal('', getftype(test_null_string())) ! CheckDefExecFailure(['echo getftype(true)'], 'E1174:') ! CheckDefExecFailure(['echo getftype(v:null)'], 'E1174:') enddef def Test_getjumplist() --- 870,909 ---- d->assert_equal({items: []}) enddef + def Test_getfontname() + CheckDefFailure(['getfontname(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + enddef + def Test_getfperm() assert_equal('', getfperm("")) assert_equal('', getfperm(test_null_string())) ! CheckDefExecFailure(['echo getfperm(true)'], 'E1013:') ! CheckDefExecFailure(['echo getfperm(v:null)'], 'E1013:') enddef def Test_getfsize() assert_equal(-1, getfsize("")) assert_equal(-1, getfsize(test_null_string())) ! CheckDefExecFailure(['echo getfsize(true)'], 'E1013:') ! CheckDefExecFailure(['echo getfsize(v:null)'], 'E1013:') enddef def Test_getftime() assert_equal(-1, getftime("")) assert_equal(-1, getftime(test_null_string())) ! CheckDefExecFailure(['echo getftime(true)'], 'E1013:') ! CheckDefExecFailure(['echo getftime(v:null)'], 'E1013:') enddef def Test_getftype() assert_equal('', getftype("")) assert_equal('', getftype(test_null_string())) ! CheckDefExecFailure(['echo getftype(true)'], 'E1013:') ! CheckDefExecFailure(['echo getftype(v:null)'], 'E1013:') enddef def Test_getjumplist() *************** *** 800,809 **** --- 912,938 ---- CheckDefFailure(['echo getjumplist(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') enddef + def Test_getmarklist() + CheckDefFailure(['getmarklist([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_equal([], getmarklist(10000)) + assert_fails('getmarklist("a%b@#")', 'E94:') + enddef + def Test_getmatches() CheckDefFailure(['echo getmatches("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_getpos() + CheckDefFailure(['getpos(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal([0, 1, 1, 0], getpos('.')) + assert_equal([0, 0, 0, 0], getpos('a')) + enddef + + def Test_getqflist() + CheckDefFailure(['getqflist([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') + call assert_equal({}, getqflist({})) + enddef + def Test_getqflist_return_type() var l = getqflist() l->assert_equal([]) *************** *** 847,852 **** --- 976,986 ---- CheckDefFailure(['echo gettagstack("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_gettext() + CheckDefFailure(['gettext(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal('abc', gettext("abc")) + enddef + def Test_getwininfo() CheckDefFailure(['echo getwininfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef *************** *** 859,864 **** --- 993,1003 ---- glob('runtest.vim', true, true, true)->assert_equal(['runtest.vim']) enddef + def Test_glob2regpat() + CheckDefFailure(['glob2regpat(null)'], 'E1013: Argument 1: type mismatch, expected string but got special') + assert_equal('^$', glob2regpat('')) + enddef + def Test_globpath() globpath('.', 'runtest.vim', true, true, true)->assert_equal(['./runtest.vim']) enddef *************** *** 880,889 **** --- 1019,1074 ---- iunabbrev foo enddef + def Test_histadd() + CheckDefFailure(['histadd(1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['histadd(":", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number') + histadd("search", 'skyblue') + assert_equal('skyblue', histget('/', -1)) + enddef + + def Test_histnr() + CheckDefFailure(['histnr(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal(-1, histnr('abc')) + enddef + + def Test_hlID() + CheckDefFailure(['hlID(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal(0, hlID('NonExistingHighlight')) + enddef + + def Test_hlexists() + CheckDefFailure(['hlexists([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_equal(0, hlexists('NonExistingHighlight')) + enddef + + def Test_iconv() + CheckDefFailure(['iconv(1, "from", "to")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['iconv("abc", 10, "to")'], 'E1013: Argument 2: type mismatch, expected string but got number') + CheckDefFailure(['iconv("abc", "from", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number') + assert_equal('abc', iconv('abc', 'fromenc', 'toenc')) + enddef + def Test_index() index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3) enddef + def Test_inputlist() + CheckDefFailure(['inputlist(10)'], 'E1013: Argument 1: type mismatch, expected list but got number') + CheckDefFailure(['inputlist("abc")'], 'E1013: Argument 1: type mismatch, expected list but got string') + CheckDefFailure(['inputlist([1, 2, 3])'], 'E1013: Argument 1: type mismatch, expected list but got list') + feedkeys("2\", 't') + var r: number = inputlist(['a', 'b', 'c']) + assert_equal(2, r) + enddef + + def Test_inputsecret() + CheckDefFailure(['inputsecret(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['inputsecret("Pass:", 20)'], 'E1013: Argument 2: type mismatch, expected string but got number') + feedkeys("\", 't') + var ans: string = inputsecret('Pass:', '123') + assert_equal('123', ans) + enddef + let s:number_one = 1 let s:number_two = 2 let s:string_keep = 'keep' *************** *** 928,940 **** CheckDefFailure(['echo invert("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef def Test_keys_return_type() const var: list = {a: 1, b: 2}->keys() var->assert_equal(['a', 'b']) enddef def Test_line() ! assert_fails('line(true)', 'E1174') enddef def Test_list2str_str2list_utf8() --- 1113,1163 ---- CheckDefFailure(['echo invert("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_isdirectory() + CheckDefFailure(['isdirectory(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float') + assert_false(isdirectory('NonExistingDir')) + enddef + + def Test_items() + CheckDefFailure(['[]->items()'], 'E1013: Argument 1: type mismatch, expected dict but got list') + assert_equal([['a', 10], ['b', 20]], {'a': 10, 'b': 20}->items()) + assert_equal([], {}->items()) + 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]')) + enddef + + def Test_json_decode() + CheckDefFailure(['json_decode(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') + assert_equal(1.0, json_decode('1.0')) + enddef + + def Test_keys() + CheckDefFailure(['keys([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') + assert_equal(['a'], {a: 'v'}->keys()) + assert_equal([], {}->keys()) + enddef + def Test_keys_return_type() const var: list = {a: 1, b: 2}->keys() var->assert_equal(['a', 'b']) enddef def Test_line() ! assert_fails('line(true)', 'E1174:') ! enddef ! ! def Test_line2byte() ! CheckDefFailure(['line2byte(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool') ! assert_equal(-1, line2byte(1)) ! assert_equal(-1, line2byte(10000)) ! enddef ! ! def Test_lispindent() ! CheckDefFailure(['lispindent({})'], 'E1013: Argument 1: type mismatch, expected string but got dict') ! assert_equal(0, lispindent(1)) enddef def Test_list2str_str2list_utf8() *************** *** 1080,1085 **** --- 1303,1315 ---- assert_equal([4, 5], l2) enddef + def Test_menu_info() + CheckDefFailure(['menu_info(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['menu_info(10, "n")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['menu_info("File", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number') + assert_equal({}, menu_info('aMenu')) + enddef + def Test_min() g:flag = true var l1: list = g:flag *************** *** 1094,1099 **** --- 1324,1334 ---- assert_equal([4, 5], l2) enddef + def Test_nextnonblank() + CheckDefFailure(['nextnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special') + assert_equal(0, nextnonblank(1)) + enddef + def Test_nr2char() nr2char(97, true)->assert_equal('a') enddef *************** *** 1103,1108 **** --- 1338,1360 ---- CheckDefFailure(['echo or(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') enddef + def Test_prevnonblank() + CheckDefFailure(['prevnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special') + assert_equal(0, prevnonblank(1)) + enddef + + def Test_prompt_getprompt() + CheckDefFailure(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_equal('', prompt_getprompt('NonExistingBuf')) + enddef + + def Test_rand() + CheckDefFailure(['rand(10)'], 'E1013: Argument 1: type mismatch, expected list but got number') + CheckDefFailure(['rand(["a"])'], 'E1013: Argument 1: type mismatch, expected list but got list') + assert_true(rand() >= 0) + assert_true(rand(srand()) >= 0) + enddef + def Test_readdir() eval expand('sautest')->readdir((e) => e[0] !=# '.') eval expand('sautest')->readdirex((e) => e.name[0] !=# '.') *************** *** 1134,1139 **** --- 1386,1426 ---- delete('Xreadfile') enddef + def Test_reltime() + CheckDefFailure(['reltime("x")'], 'E1013: Argument 1: type mismatch, expected list but got string') + CheckDefFailure(['reltime(["x", "y"])'], 'E1013: Argument 1: type mismatch, expected list but got list') + CheckDefFailure(['reltime([1, 2], 10)'], 'E1013: Argument 2: type mismatch, expected list but got number') + CheckDefFailure(['reltime([1, 2], ["a", "b"])'], 'E1013: Argument 2: type mismatch, expected list but got list') + var start: list = reltime() + assert_true(type(reltime(start)) == v:t_list) + var end: list = reltime() + assert_true(type(reltime(start, end)) == v:t_list) + enddef + + def Test_reltimefloat() + CheckDefFailure(['reltimefloat("x")'], 'E1013: Argument 1: type mismatch, expected list but got string') + CheckDefFailure(['reltimefloat([1.1])'], 'E1013: Argument 1: type mismatch, expected list but got list') + assert_true(type(reltimefloat(reltime())) == v:t_float) + enddef + + def Test_reltimestr() + CheckDefFailure(['reltimestr(true)'], 'E1013: Argument 1: type mismatch, expected list but got bool') + CheckDefFailure(['reltimestr([true])'], 'E1013: Argument 1: type mismatch, expected list but got list') + assert_true(type(reltimestr(reltime())) == v:t_string) + enddef + + def Test_remote_foreground() + CheckFeature clientserver + # remote_foreground() doesn't fail on MS-Windows + CheckNotMSWindows + CheckDefFailure(['remote_foreground(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_fails('remote_foreground("NonExistingServer")', 'E241:') + enddef + + def Test_remote_startserver() + CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict') + enddef + def Test_remove_return_type() var l = remove({one: [1, 2], two: [3, 4]}, 'one') var res = 0 *************** *** 1143,1148 **** --- 1430,1445 ---- res->assert_equal(3) enddef + def Test_rename() + CheckDefFailure(['rename(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['rename("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number') + enddef + + def Test_resolve() + CheckDefFailure(['resolve([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_equal('SomeFile', resolve('SomeFile')) + enddef + def Test_reverse_return_type() var l = reverse([1, 2, 3]) var res = 0 *************** *** 1167,1172 **** --- 1464,1476 ---- CheckDefFailure(['echo screenchars(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') enddef + def Test_screenpos() + CheckDefFailure(['screenpos("a", 1, 1)'], 'E1013: Argument 1: type mismatch, expected number but got string') + CheckDefFailure(['screenpos(1, "b", 1)'], 'E1013: Argument 2: type mismatch, expected number but got string') + CheckDefFailure(['screenpos(1, 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string') + assert_equal({col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(1, 1, 1)) + enddef + def Test_screenstring() CheckDefFailure(['echo screenstring("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string') CheckDefFailure(['echo screenstring(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') *************** *** 1334,1343 **** --- 1638,1660 ---- 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(['echo 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_setloclist() var items = [{filename: '/tmp/file', lnum: 1, valid: true}] var what = {items: items} *************** *** 1353,1362 **** --- 1670,1690 ---- assert_fails('setreg("ab", 0)', 'E1162:') 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') + assert_equal('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', sha256('abc')) + enddef + def Test_shiftwidth() CheckDefFailure(['echo shiftwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') enddef + def Test_simplify() + CheckDefFailure(['simplify(100)'], 'E1013: Argument 1: type mismatch, expected string but got number') + call assert_equal('NonExistingFile', simplify('NonExistingFile')) + enddef + def Test_slice() assert_equal('12345', slice('012345', 1)) assert_equal('123', slice('012345', 1, 4)) *************** *** 1388,1393 **** --- 1716,1731 ---- endif enddef + def Test_sound_stop() + CheckFeature sound + CheckDefFailure(['sound_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') + enddef + + def Test_soundfold() + CheckDefFailure(['soundfold(20)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal('abc', soundfold('abc')) + enddef + def Test_sort_return_type() var res: list res = [1, 2, 3]->sort() *************** *** 1408,1417 **** --- 1746,1770 ---- CheckDefAndScriptSuccess(lines) enddef + def Test_spellbadword() + CheckDefFailure(['spellbadword(100)'], 'E1013: Argument 1: type mismatch, expected string but got number') + spellbadword('good')->assert_equal(['', '']) + enddef + def Test_split() split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) enddef + def Test_srand() + CheckDefFailure(['srand("a")'], 'E1013: Argument 1: type mismatch, expected number but got string') + type(srand(100))->assert_equal(v:t_list) + enddef + + def Test_state() + CheckDefFailure(['state({})'], 'E1013: Argument 1: type mismatch, expected string but got dict') + assert_equal('', state('a')) + enddef + def Run_str2float() if !has('float') MissingFeature 'float' *************** *** 1439,1444 **** --- 1792,1824 ---- strchars("A\u20dd", true)->assert_equal(1) enddef + def Test_strlen() + CheckDefFailure(['strlen([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + "abc"->strlen()->assert_equal(3) + strlen(99)->assert_equal(2) + enddef + + def Test_strptime() + CheckFunction strptime + CheckDefFailure(['strptime(10, "2021")'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckDefFailure(['strptime("%Y", 2021)'], 'E1013: Argument 2: type mismatch, expected string but got number') + # BUG: Directly calling strptime() in this function gives an "E117: Unknown + # function" error on MS-Windows even with the above CheckFunction call for + # strptime(). + #assert_true(strptime('%Y', '2021') != 0) + enddef + + def Test_strtrans() + CheckDefFailure(['strtrans(20)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal('abc', strtrans('abc')) + enddef + + def Test_strwidth() + CheckDefFailure(['strwidth(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + CheckScriptFailure(['vim9script', 'echo strwidth(10)'], 'E1024:') + assert_equal(4, strwidth('abcd')) + enddef + def Test_submatch() var pat = 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)' var Rep = () => range(10)->mapnew((_, v) => submatch(v, true))->string() *************** *** 1457,1462 **** --- 1837,1852 ---- endif enddef + def Test_swapinfo() + CheckDefFailure(['swapinfo({})'], 'E1013: Argument 1: type mismatch, expected string but got dict') + call assert_equal({error: 'Cannot open file'}, swapinfo('x')) + enddef + + def Test_swapname() + CheckDefFailure(['swapname([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_fails('swapname("NonExistingBuf")', 'E94:') + enddef + def Test_synID() new setline(1, "text") *************** *** 1464,1469 **** --- 1854,1875 ---- bwipe! enddef + def Test_synIDtrans() + CheckDefFailure(['synIDtrans("a")'], 'E1013: Argument 1: type mismatch, expected number but got string') + enddef + + def Test_tabpagebuflist() + CheckDefFailure(['tabpagebuflist("t")'], 'E1013: Argument 1: type mismatch, expected number but got string') + assert_equal([bufnr('')], tabpagebuflist()) + assert_equal([bufnr('')], tabpagebuflist(1)) + enddef + + def Test_tabpagenr() + CheckDefFailure(['tabpagenr(1)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal(1, tabpagenr('$')) + assert_equal(1, tabpagenr()) + enddef + def Test_term_gettty() if !has('terminal') MissingFeature 'terminal' *************** *** 1486,1491 **** --- 1892,1903 ---- endif enddef + def Test_timer_info() + CheckDefFailure(['timer_info("id")'], 'E1013: Argument 1: type mismatch, expected number but got string') + assert_equal([], timer_info(100)) + assert_equal([], timer_info()) + enddef + def Test_timer_paused() var id = timer_start(50, () => 0) timer_pause(id, true) *************** *** 1494,1499 **** --- 1906,1916 ---- timer_stop(id) enddef + def Test_timer_stop() + CheckDefFailure(['timer_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string') + assert_equal(0, timer_stop(100)) + enddef + def Test_tolower() CheckDefFailure(['echo tolower(1)'], 'E1013: Argument 1: type mismatch, expected string but got number') enddef *************** *** 1508,1524 **** --- 1925,1970 ---- CheckDefFailure(['echo tr("a", "a", 1)'], 'E1013: Argument 3: type mismatch, expected string but got number') enddef + def Test_undofile() + CheckDefFailure(['undofile(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') + assert_equal('.abc.un~', fnamemodify(undofile('abc'), ':t')) + enddef + + def Test_values() + CheckDefFailure(['values([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') + assert_equal([], {}->values()) + assert_equal(['sun'], {star: 'sun'}->values()) + enddef + def Test_win_execute() assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()')) assert_equal('', win_execute(342343, 'echo winnr()')) enddef + def Test_win_findbuf() + CheckDefFailure(['win_findbuf("a")'], 'E1013: Argument 1: type mismatch, expected number but got string') + assert_equal([], win_findbuf(1000)) + assert_equal([win_getid()], win_findbuf(bufnr(''))) + enddef + + def Test_win_getid() + CheckDefFailure(['win_getid(".")'], 'E1013: Argument 1: type mismatch, expected number but got string') + CheckDefFailure(['win_getid(1, ".")'], 'E1013: Argument 2: type mismatch, expected number but got string') + assert_equal(win_getid(), win_getid(1, 1)) + enddef + def Test_win_splitmove() split win_splitmove(1, 2, {vertical: true, rightbelow: true}) close enddef + def Test_winnr() + CheckDefFailure(['winnr([])'], 'E1013: Argument 1: type mismatch, expected string but got list') + assert_equal(1, winnr()) + assert_equal(1, winnr('$')) + enddef + def Test_winrestcmd() split var cmd = winrestcmd() *************** *** 1528,1533 **** --- 1974,1987 ---- close enddef + def Test_winrestview() + CheckDefFailure(['winrestview([])'], 'E1013: Argument 1: type mismatch, expected dict but got list') + :%d _ + setline(1, 'Hello World') + winrestview({lnum: 1, col: 6}) + assert_equal([1, 7], [line('.'), col('.')]) + enddef + def Test_winsaveview() var view: dict = winsaveview() *** ../vim-8.2.3083/src/testdir/test_vim9_expr.vim 2021-06-19 20:45:07.353511358 +0200 --- src/testdir/test_vim9_expr.vim 2021-07-03 11:53:01.558586873 +0200 *************** *** 2973,2985 **** lines =<< trim END def RetVoid() enddef - RetVoid()->byte2line() - END - CheckDefExecAndScriptFailure(lines, 'E1031:') - - lines =<< trim END - def RetVoid() - enddef RetVoid()->byteidx(3) END CheckDefExecAndScriptFailure(lines, 'E1031:') --- 2973,2978 ---- *** ../vim-8.2.3083/src/version.c 2021-07-02 20:19:27.964669621 +0200 --- src/version.c 2021-07-03 11:54:33.754359104 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3084, /**/ -- hundred-and-one symptoms of being an internet addict: 75. You start wondering whether you could actually upgrade your brain with a Pentium Pro microprocessor 80. The upgrade works just fine. /// 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 ///