summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-27 22:00:44 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-27 22:00:44 +0200
commit4490ec4e839e45a2e6923c265c7e9e64c240b805 (patch)
tree3ef2dc127890ac6a644f38ae7932b7e70071544a
parent5d7c2df536c17db4a9c61e0760bdcf78d0db7330 (diff)
downloadvim-git-4490ec4e839e45a2e6923c265c7e9e64c240b805.tar.gz
patch 8.2.3229: Vim9: runtime and compile time type checks are not the samev8.2.3229
Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
-rw-r--r--src/arglist.c15
-rw-r--r--src/change.c9
-rw-r--r--src/channel.c47
-rw-r--r--src/cindent.c3
-rw-r--r--src/clientserver.c39
-rw-r--r--src/cmdhist.c11
-rw-r--r--src/dict.c8
-rw-r--r--src/diff.c3
-rw-r--r--src/digraph.c12
-rw-r--r--src/errors.h20
-rw-r--r--src/eval.c4
-rw-r--r--src/evalbuffer.c54
-rw-r--r--src/evalfunc.c311
-rw-r--r--src/evalwindow.c71
-rw-r--r--src/ex_docmd.c7
-rw-r--r--src/ex_getln.c17
-rw-r--r--src/filepath.c62
-rw-r--r--src/findfile.c3
-rw-r--r--src/float.c88
-rw-r--r--src/fold.c10
-rw-r--r--src/getchar.c3
-rw-r--r--src/indent.c6
-rw-r--r--src/insexpand.c8
-rw-r--r--src/job.c18
-rw-r--r--src/json.c6
-rw-r--r--src/list.c5
-rw-r--r--src/mark.c3
-rw-r--r--src/match.c26
-rw-r--r--src/mbyte.c9
-rw-r--r--src/menu.c5
-rw-r--r--src/misc1.c8
-rw-r--r--src/move.c6
-rw-r--r--src/popupwin.c55
-rw-r--r--src/proto/typval.pro7
-rw-r--r--src/quickfix.c8
-rw-r--r--src/search.c3
-rw-r--r--src/sign.c18
-rw-r--r--src/sound.c9
-rw-r--r--src/strings.c65
-rw-r--r--src/terminal.c67
-rw-r--r--src/testdir/test_assert.vim2
-rw-r--r--src/testdir/test_blob.vim2
-rw-r--r--src/testdir/test_execute_func.vim2
-rw-r--r--src/testdir/test_float_func.vim3
-rw-r--r--src/testdir/test_functions.vim9
-rw-r--r--src/testdir/test_glob2regpat.vim3
-rw-r--r--src/testdir/test_listdict.vim2
-rw-r--r--src/testdir/test_vim9_builtin.vim964
-rw-r--r--src/testdir/test_vim9_script.vim2
-rw-r--r--src/testing.c61
-rw-r--r--src/textprop.c26
-rw-r--r--src/time.c24
-rw-r--r--src/typval.c106
-rw-r--r--src/undo.c3
-rw-r--r--src/version.c2
55 files changed, 1710 insertions, 630 deletions
diff --git a/src/arglist.c b/src/arglist.c
index 863b1cc6a..5370142a7 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -1271,6 +1271,9 @@ f_argc(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
// use the current window
rettv->vval.v_number = ARGCOUNT;
@@ -1306,6 +1309,12 @@ f_arglistid(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
rettv->vval.v_number = -1;
wp = find_tabwin(&argvars[0], &argvars[1], NULL);
if (wp != NULL)
@@ -1336,6 +1345,12 @@ f_argv(typval_T *argvars, typval_T *rettv)
aentry_T *arglist = NULL;
int argcount = -1;
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (argvars[1].v_type == VAR_UNKNOWN)
diff --git a/src/change.c b/src/change.c
index f77b48c74..799aa5efb 100644
--- a/src/change.c
+++ b/src/change.c
@@ -281,6 +281,9 @@ f_listener_flush(typval_T *argvars, typval_T *rettv UNUSED)
{
buf_T *buf = curbuf;
+ if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
buf = get_buf_arg(&argvars[0]);
@@ -299,9 +302,13 @@ f_listener_remove(typval_T *argvars, typval_T *rettv)
listener_T *lnr;
listener_T *next;
listener_T *prev;
- int id = tv_get_number(argvars);
+ int id;
buf_T *buf;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = tv_get_number(argvars);
FOR_ALL_BUFFERS(buf)
{
prev = NULL;
diff --git a/src/channel.c b/src/channel.c
index 46bdc0ec8..5307792e8 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -3865,6 +3865,11 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob)
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, 1) == FAIL))
+ return;
+
clear_job_options(&opt);
if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID, 0)
== FAIL)
@@ -4784,9 +4789,13 @@ channel_get_timeout(channel_T *channel, ch_part_T part)
void
f_ch_canread(typval_T *argvars, typval_T *rettv)
{
- channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
+ channel_T *channel;
rettv->vval.v_number = 0;
+ if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL)
+ return;
+
+ channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
if (channel != NULL)
rettv->vval.v_number = channel_has_readahead(channel, PART_SOCK)
|| channel_has_readahead(channel, PART_OUT)
@@ -4799,8 +4808,12 @@ f_ch_canread(typval_T *argvars, typval_T *rettv)
void
f_ch_close(typval_T *argvars, typval_T *rettv UNUSED)
{
- channel_T *channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0);
+ channel_T *channel;
+ if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL)
+ return;
+
+ channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0);
if (channel != NULL)
{
channel_close(channel, FALSE);
@@ -4814,8 +4827,12 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED)
void
f_ch_close_in(typval_T *argvars, typval_T *rettv UNUSED)
{
- channel_T *channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0);
+ channel_T *channel;
+ if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL)
+ return;
+
+ channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0);
if (channel != NULL)
channel_close_in(channel);
}
@@ -4861,8 +4878,12 @@ f_ch_getbufnr(typval_T *argvars, typval_T *rettv)
void
f_ch_getjob(typval_T *argvars, typval_T *rettv)
{
- channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
+ channel_T *channel;
+ if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL)
+ return;
+
+ channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
if (channel != NULL)
{
rettv->v_type = VAR_JOB;
@@ -4878,8 +4899,12 @@ f_ch_getjob(typval_T *argvars, typval_T *rettv)
void
f_ch_info(typval_T *argvars, typval_T *rettv UNUSED)
{
- channel_T *channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
+ channel_T *channel;
+ if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL)
+ return;
+
+ channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
if (channel != NULL && rettv_dict_alloc(rettv) != FAIL)
channel_info(channel, rettv->vval.v_dict);
}
@@ -4921,7 +4946,7 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED)
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
- || check_for_string_arg(argvars, 1) == FAIL))
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
return;
fname = tv_get_string(&argvars[0]);
@@ -5014,6 +5039,11 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
channel_T *channel;
jobopt_T opt;
+ if (in_vim9script()
+ && (check_for_chan_or_job_arg(argvars, 0) == FAIL
+ || check_for_dict_arg(argvars, 1) == FAIL))
+ return;
+
channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
if (channel == NULL)
return;
@@ -5038,6 +5068,11 @@ f_ch_status(typval_T *argvars, typval_T *rettv)
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, 1) == FAIL))
+ return;
+
channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
if (argvars[1].v_type != VAR_UNKNOWN)
diff --git a/src/cindent.c b/src/cindent.c
index ce02402c2..b75120653 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -4129,6 +4129,9 @@ f_cindent(typval_T *argvars UNUSED, typval_T *rettv)
pos_T pos;
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
pos = curwin->w_cursor;
lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
diff --git a/src/clientserver.c b/src/clientserver.c
index 3c0a930ed..4ad17f4f9 100644
--- a/src/clientserver.c
+++ b/src/clientserver.c
@@ -814,6 +814,9 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv)
f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#ifdef FEAT_CLIENTSERVER
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
# ifdef MSWIN
// On Win32 it's done in this application.
{
@@ -846,17 +849,18 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv)
# endif
char_u *serverid;
+ rettv->vval.v_number = -1;
if (check_restricted() || check_secure())
- {
- rettv->vval.v_number = -1;
return;
- }
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
serverid = tv_get_string_chk(&argvars[0]);
if (serverid == NULL)
- {
- rettv->vval.v_number = -1;
return; // type error; errmsg already given
- }
# ifdef MSWIN
sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n);
if (n == 0)
@@ -959,8 +963,12 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv)
f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#ifdef FEAT_CLIENTSERVER
- char_u *server = tv_get_string_chk(&argvars[0]);
+ char_u *server;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+ server = tv_get_string_chk(&argvars[0]);
if (server == NULL)
return; // type error; errmsg already given
if (serverName != NULL)
@@ -984,14 +992,23 @@ f_server2client(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef FEAT_CLIENTSERVER
char_u buf[NUMBUFLEN];
- char_u *server = tv_get_string_chk(&argvars[0]);
- char_u *reply = tv_get_string_buf_chk(&argvars[1], buf);
+ char_u *server;
+ char_u *reply;
rettv->vval.v_number = -1;
- if (server == NULL || reply == NULL)
- return;
if (check_restricted() || check_secure())
return;
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
+ server = tv_get_string_chk(&argvars[0]);
+ reply = tv_get_string_buf_chk(&argvars[1], buf);
+ if (server == NULL || reply == NULL)
+ return;
+
# ifdef FEAT_X11
if (check_connection() == FAIL)
return;
diff --git a/src/cmdhist.c b/src/cmdhist.c
index f3b8b007e..0ac3ff694 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -545,6 +545,12 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv)
rettv->vval.v_number = FALSE;
if (check_secure())
return;
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
str = tv_get_string_chk(&argvars[0]); // NULL on type error
histype = str != NULL ? get_histtype(str) : -1;
if (histype >= 0)
@@ -630,9 +636,12 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv)
f_histnr(typval_T *argvars UNUSED, typval_T *rettv)
{
int i;
+ char_u *histname;
- char_u *histname = tv_get_string_chk(&argvars[0]);
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+ histname = tv_get_string_chk(&argvars[0]);
i = histname == NULL ? HIST_CMD - 1 : get_histtype(histname);
if (i >= HIST_CMD && i < HIST_COUNT)
i = get_history_idx(i);
diff --git a/src/dict.c b/src/dict.c
index 768adf0de..82397d512 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -1201,6 +1201,9 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
dict_T *d;
int todo;
+ if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_DICT)
{
emsg(_(e_dictreq));
@@ -1318,6 +1321,11 @@ dict_set_items_ro(dict_T *di)
void
f_has_key(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_dict_arg(argvars, 0) == FAIL
+ || check_for_string_or_number_arg(argvars, 1) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_DICT)
{
emsg(_(e_dictreq));
diff --git a/src/diff.c b/src/diff.c
index a47259e1a..aea1c0e70 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -3272,6 +3272,9 @@ xdiff_out(void *priv, mmbuffer_t *mb, int nbuf)
f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#ifdef FEAT_DIFF
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars));
#endif
}
diff --git a/src/digraph.c b/src/digraph.c
index 745cbbb74..4a185399d 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2406,6 +2406,10 @@ f_digraph_get(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL; // Return empty string for failure
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
digraphs = tv_get_string_chk(&argvars[0]);
if (digraphs == NULL)
@@ -2439,6 +2443,9 @@ f_digraph_getlist(typval_T *argvars, typval_T *rettv)
# ifdef FEAT_DIGRAPHS
int flag_list_all;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
flag_list_all = FALSE;
else
@@ -2466,6 +2473,11 @@ f_digraph_set(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = VVAL_FALSE;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
if (!digraph_set_common(&argvars[0], &argvars[1]))
return;
diff --git a/src/errors.h b/src/errors.h
index 7e4a46522..b76b92fa5 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -617,3 +617,23 @@ EXTERN char e_chan_or_job_required_for_argument_nr[]
INIT(= N_("E1217: Channel or Job required for argument %d"));
EXTERN char e_job_required_for_argument_nr[]
INIT(= N_("E1218: Job required for argument %d"));
+EXTERN char e_float_or_number_required_for_argument_nr[]
+ INIT(= N_("E1219: Float or Number required for argument %d"));
+EXTERN char e_string_or_number_required_for_argument_nr[]
+ INIT(= N_("E1220: String or Number required for argument %d"));
+EXTERN char e_string_or_blob_required_for_argument_nr[]
+ INIT(= N_("E1221: String or Blob required for argument %d"));
+EXTERN char e_string_or_list_required_for_argument_nr[]
+ INIT(= N_("E1222: String or List required for argument %d"));
+EXTERN char e_string_or_dict_required_for_argument_nr[]
+ INIT(= N_("E1223: String or List required for argument %d"));
+EXTERN char e_string_or_number_or_list_required_for_argument_nr[]
+ INIT(= N_("E1224: String or List required for argument %d"));
+EXTERN char e_string_or_list_or_dict_required_for_argument_nr[]
+ INIT(= N_("E1225: String or List required for argument %d"));
+EXTERN char e_list_or_blob_required_for_argument_nr[]
+ INIT(= N_("E1226: String or List required for argument %d"));
+EXTERN char e_list_or_dict_required_for_argument_nr[]
+ INIT(= N_("E1227: List or Dictionary required for argument %d"));
+EXTERN char e_list_or_dict_or_blob_required_for_argument_nr[]
+ INIT(= N_("E1228: List or Dictionary or Blob required for argument %d"));
diff --git a/src/eval.c b/src/eval.c
index 8050bbbbe..0d41f1780 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4190,9 +4190,9 @@ check_can_index(typval_T *rettv, int evaluate, int verbose)
f_slice(typval_T *argvars, typval_T *rettv)
{
if (in_vim9script()
- && ((argvars[0].v_type != VAR_LIST
+ && ((argvars[0].v_type != VAR_STRING
+ && 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))
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index bb6ff63df..3fb037c5f 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -277,8 +277,12 @@ done:
void
f_append(typval_T *argvars, typval_T *rettv)
{
- linenr_T lnum = tv_get_lnum(&argvars[0]);
+ linenr_T lnum;
+
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+ lnum = tv_get_lnum(&argvars[0]);
set_buffer_lines(curbuf, lnum, TRUE, &argvars[1], rettv);
}
@@ -291,6 +295,12 @@ f_appendbufline(typval_T *argvars, typval_T *rettv)
linenr_T lnum;
buf_T *buf;
+ if (in_vim9script()
+ && (check_for_buffer_arg(argvars, 0) == FAIL
+ || check_for_lnum_arg(argvars, 1) == FAIL
+ || check_for_string_or_number_or_list_arg(argvars, 2) == FAIL))
+ return;
+
buf = tv_get_buf(&argvars[0], FALSE);
if (buf == NULL)
rettv->vval.v_number = 1; // FAIL
@@ -307,8 +317,12 @@ f_appendbufline(typval_T *argvars, typval_T *rettv)
void
f_bufadd(typval_T *argvars, typval_T *rettv)
{
- char_u *name = tv_get_string(&argvars[0]);
+ char_u *name;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ name = tv_get_string(&argvars[0]);
rettv->vval.v_number = buflist_add(*name == NUL ? NULL : name, 0);
}
@@ -318,6 +332,9 @@ f_bufadd(typval_T *argvars, typval_T *rettv)
void
f_bufexists(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = (find_buffer(&argvars[0]) != NULL);
}
@@ -329,6 +346,9 @@ f_buflisted(typval_T *argvars, typval_T *rettv)
{
buf_T *buf;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
buf = find_buffer(&argvars[0]);
rettv->vval.v_number = (buf != NULL && buf->b_p_bl);
}
@@ -339,8 +359,12 @@ f_buflisted(typval_T *argvars, typval_T *rettv)
void
f_bufload(typval_T *argvars, typval_T *rettv UNUSED)
{
- buf_T *buf = get_buf_arg(&argvars[0]);
+ buf_T *buf;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = get_buf_arg(&argvars[0]);
if (buf != NULL)
buffer_ensure_loaded(buf);
}
@@ -353,6 +377,9 @@ f_bufloaded(typval_T *argvars, typval_T *rettv)
{
buf_T *buf;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
buf = find_buffer(&argvars[0]);
rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL);
}
@@ -366,6 +393,9 @@ f_bufname(typval_T *argvars, typval_T *rettv)
buf_T *buf;
typval_T *tv = &argvars[0];
+ if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
+ return;
+
if (tv->v_type == VAR_UNKNOWN)
buf = curbuf;
else
@@ -421,6 +451,9 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr)
int winnr = 0;
buf_T *buf;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
buf = tv_get_buf_from_arg(&argvars[0]);
FOR_ALL_WINDOWS(wp)
{
@@ -636,8 +669,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv)
return;
if (in_vim9script()
- && argvars[0].v_type != VAR_UNKNOWN
- && check_for_buffer_or_dict_arg(argvars, 0) == FAIL)
+ && check_for_opt_buffer_or_dict_arg(argvars, 0) == FAIL)
return;
// List of all the buffers or selected buffers
@@ -808,6 +840,12 @@ f_setbufline(typval_T *argvars, typval_T *rettv)
linenr_T lnum;
buf_T *buf;
+ if (in_vim9script()
+ && (check_for_buffer_arg(argvars, 0) == FAIL
+ || check_for_lnum_arg(argvars, 1) == FAIL
+ || check_for_string_or_number_or_list_arg(argvars, 2) == FAIL))
+ return;
+
buf = tv_get_buf(&argvars[0], FALSE);
if (buf == NULL)
rettv->vval.v_number = 1; // FAIL
@@ -824,8 +862,12 @@ f_setbufline(typval_T *argvars, typval_T *rettv)
void
f_setline(typval_T *argvars, typval_T *rettv)
{
- linenr_T lnum = tv_get_lnum(&argvars[0]);
+ linenr_T lnum;
+
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+ lnum = tv_get_lnum(&argvars[0]);
set_buffer_lines(curbuf, lnum, FALSE, &argvars[1], rettv);
}
#endif // FEAT_EVAL
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 2a9c972f9..7fc1821c6 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -762,7 +762,7 @@ static argcheck_T arg3_string_number_bool[] = {arg_string, arg_number, arg_bool}
static argcheck_T arg3_string_number_number[] = {arg_string, arg_number, arg_number};
static argcheck_T arg3_string_string_bool[] = {arg_string, arg_string, arg_bool};
static argcheck_T arg3_string_string_dict[] = {arg_string, arg_string, arg_dict_any};
-static argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number};
+static argcheck_T arg3_string_string_number[] = {arg_string, arg_string, arg_number};
static argcheck_T arg4_list_number_number_number[] = {arg_list_string, arg_number, arg_number, arg_number};
static argcheck_T arg4_number_number_string_any[] = {arg_number, arg_number, arg_string, NULL};
static argcheck_T arg4_string_string_any_string[] = {arg_string, arg_string, NULL, arg_string};
@@ -811,7 +811,7 @@ static argcheck_T arg24_strpart[] = {arg_string, arg_number, arg_number, arg_boo
static argcheck_T arg12_system[] = {arg_string, arg_str_or_nr_or_list};
static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string};
static argcheck_T arg23_writefile[] = {arg_list_or_blob, arg_string, arg_string};
-static argcheck_T arg4_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number};
+static argcheck_T arg24_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number};
/*
@@ -1340,9 +1340,9 @@ static funcentry_T global_functions[] =
ret_number, f_filewritable},
{"filter", 2, 2, FEARG_1, arg2_mapfilter,
ret_first_arg, f_filter},
- {"finddir", 1, 3, FEARG_1, arg3_string_string_nr,
+ {"finddir", 1, 3, FEARG_1, arg3_string_string_number,
ret_string, f_finddir},
- {"findfile", 1, 3, FEARG_1, arg3_string_string_nr,
+ {"findfile", 1, 3, FEARG_1, arg3_string_string_number,
ret_string, f_findfile},
{"flatten", 1, 2, FEARG_1, arg2_list_any_number,
ret_list_any, f_flatten},
@@ -1608,7 +1608,7 @@ static funcentry_T global_functions[] =
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,
+ {"match", 2, 4, FEARG_1, arg24_match_func,
ret_any, f_match},
{"matchadd", 2, 5, FEARG_1, arg25_matchadd,
ret_number, f_matchadd},
@@ -1618,17 +1618,17 @@ static funcentry_T global_functions[] =
ret_list_string, f_matcharg},
{"matchdelete", 1, 2, FEARG_1, arg2_number,
ret_number_bool, f_matchdelete},
- {"matchend", 2, 4, FEARG_1, arg4_match_func,
+ {"matchend", 2, 4, FEARG_1, arg24_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,
+ {"matchlist", 2, 4, FEARG_1, arg24_match_func,
ret_list_string, f_matchlist},
- {"matchstr", 2, 4, FEARG_1, arg4_match_func,
+ {"matchstr", 2, 4, FEARG_1, arg24_match_func,
ret_string, f_matchstr},
- {"matchstrpos", 2, 4, FEARG_1, arg4_match_func,
+ {"matchstrpos", 2, 4, FEARG_1, arg24_match_func,
ret_list_any, f_matchstrpos},
{"max", 1, 1, FEARG_1, arg1_list_or_dict,
ret_number, f_max},
@@ -1642,7 +1642,7 @@ static funcentry_T global_functions[] =
},
{"min", 1, 1, FEARG_1, arg1_list_or_dict,
ret_number, f_min},
- {"mkdir", 1, 3, FEARG_1, arg3_string_string_nr,
+ {"mkdir", 1, 3, FEARG_1, arg3_string_string_number,
ret_number_bool, f_mkdir},
{"mode", 0, 1, FEARG_1, arg1_bool,
ret_string, f_mode},
@@ -1784,7 +1784,7 @@ static funcentry_T global_functions[] =
ret_list_string, f_readdir},
{"readdirex", 1, 3, FEARG_1, arg3_string_any_dict,
ret_list_dict_any, f_readdirex},
- {"readfile", 1, 3, FEARG_1, arg3_string_string_nr,
+ {"readfile", 1, 3, FEARG_1, arg3_string_string_number,
ret_list_string, f_readfile},
{"reduce", 2, 3, FEARG_1, arg23_reduce,
ret_any, f_reduce},
@@ -1984,7 +1984,7 @@ static funcentry_T global_functions[] =
},
{"strgetchar", 2, 2, FEARG_1, arg2_string_number,
ret_number, f_strgetchar},
- {"stridx", 2, 3, FEARG_1, arg3_string_string_nr,
+ {"stridx", 2, 3, FEARG_1, arg3_string_string_number,
ret_number, f_stridx},
{"string", 1, 1, FEARG_1, NULL,
ret_string, f_string},
@@ -2000,7 +2000,7 @@ static funcentry_T global_functions[] =
NULL
#endif
},
- {"strridx", 2, 3, FEARG_1, arg3_string_string_nr,
+ {"strridx", 2, 3, FEARG_1, arg3_string_string_number,
ret_number, f_strridx},
{"strtrans", 1, 1, FEARG_1, arg1_string,
ret_string, f_strtrans},
@@ -2180,7 +2180,7 @@ static funcentry_T global_functions[] =
ret_string, f_toupper},
{"tr", 3, 3, FEARG_1, arg3_string,
ret_string, f_tr},
- {"trim", 1, 3, FEARG_1, arg3_string_string_nr,
+ {"trim", 1, 3, FEARG_1, arg3_string_string_number,
ret_string, f_trim},
{"trunc", 1, 1, FEARG_1, arg1_float_or_nr,
ret_float, FLOAT_FUNC(f_trunc)},
@@ -2607,6 +2607,11 @@ non_zero_arg(typval_T *argvars)
static void
f_and(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL)
& tv_get_number_chk(&argvars[1], NULL);
}
@@ -2633,6 +2638,10 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
{
if (balloonEval != NULL)
{
+ if (in_vim9script()
+ && check_for_string_or_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_LIST
# ifdef FEAT_GUI
&& !gui.in_use
@@ -2717,6 +2726,9 @@ f_byte2line(typval_T *argvars UNUSED, typval_T *rettv)
#else
long boff = 0;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
boff = tv_get_number(&argvars[0]) - 1; // boff gets -1 on type error
if (boff < 0)
rettv->vval.v_number = -1;
@@ -2822,6 +2834,10 @@ get_col(typval_T *argvars, typval_T *rettv, int charcol)
pos_T *fp;
int fnum = curbuf->b_fnum;
+ if (in_vim9script()
+ && check_for_string_or_list_arg(argvars, 0) == FAIL)
+ return;
+
fp = var2fpos(&argvars[0], FALSE, &fnum, charcol);
if (fp != NULL && fnum == curbuf->b_fnum)
{
@@ -2982,10 +2998,7 @@ set_cursorpos(typval_T *argvars, typval_T *rettv, int charcol)
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_string_or_number_or_list_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)))
@@ -3071,6 +3084,9 @@ f_debugbreak(typval_T *argvars, typval_T *rettv)
int pid;
rettv->vval.v_number = FAIL;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
pid = (int)tv_get_number(&argvars[0]);
if (pid == 0)
emsg(_(e_invarg));
@@ -3269,6 +3285,11 @@ f_escape(typval_T *argvars, typval_T *rettv)
{
char_u buf[NUMBUFLEN];
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
rettv->vval.v_string = vim_strsave_escaped(tv_get_string(&argvars[0]),
tv_get_string_buf(&argvars[1], buf));
rettv->v_type = VAR_STRING;
@@ -3282,6 +3303,9 @@ f_eval(typval_T *argvars, typval_T *rettv)
{
char_u *s, *p;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
s = tv_get_string_chk(&argvars[0]);
if (s != NULL)
s = skipwhite(s);
@@ -3475,6 +3499,11 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
static void
f_execute(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_string_or_list_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
execute_common(argvars, rettv, 0);
}
@@ -3487,6 +3516,9 @@ f_exists(typval_T *argvars, typval_T *rettv)
char_u *p;
int n = FALSE;
+ if (in_vim9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL)
+ return;
+
p = tv_get_string(&argvars[0]);
if (*p == '$') // environment variable
{
@@ -3631,6 +3663,9 @@ f_expandcmd(typval_T *argvars, typval_T *rettv)
char_u *cmdstr;
char *errormsg = NULL;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
cmdstr = vim_strsave(tv_get_string(&argvars[0]));
@@ -3671,6 +3706,11 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
if (check_secure())
return;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
keys = tv_get_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN)
@@ -3760,6 +3800,9 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
static void
f_fnameescape(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_string = vim_strsave_fnameescape(
tv_get_string(&argvars[0]), FALSE);
rettv->v_type = VAR_STRING;
@@ -4029,6 +4072,9 @@ f_function(typval_T *argvars, typval_T *rettv)
static void
f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+
// This is postponed until we are back at the toplevel, because we may be
// using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]".
want_garbage_collect = TRUE;
@@ -4175,6 +4221,9 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
+ return;
+
#ifdef FEAT_JUMPLIST
if (argvars[0].v_type == VAR_UNKNOWN)
buf = curbuf;
@@ -4292,6 +4341,9 @@ getpos_both(
static void
f_getcharpos(typval_T *argvars UNUSED, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
getpos_both(argvars, rettv, FALSE, TRUE);
}
@@ -4318,8 +4370,12 @@ f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv)
f_getenv(typval_T *argvars, typval_T *rettv)
{
int mustfree = FALSE;
- char_u *p = vim_getenv(tv_get_string(&argvars[0]), &mustfree);
+ char_u *p;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ p = vim_getenv(tv_get_string(&argvars[0]), &mustfree);
if (p == NULL)
{
rettv->v_type = VAR_SPECIAL;
@@ -4340,6 +4396,10 @@ f_getfontname(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
#ifdef FEAT_GUI
if (gui.in_use)
{
@@ -4385,6 +4445,12 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
#ifdef FEAT_JUMPLIST
wp = find_tabwin(&argvars[0], &argvars[1], NULL);
if (wp == NULL)
@@ -4433,12 +4499,18 @@ f_getpid(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_getcurpos(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
getpos_both(argvars, rettv, TRUE, FALSE);
}
static void
f_getcursorcharpos(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
getpos_both(argvars, rettv, TRUE, TRUE);
}
@@ -4448,6 +4520,9 @@ f_getcursorcharpos(typval_T *argvars, typval_T *rettv)
static void
f_getpos(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
getpos_both(argvars, rettv, FALSE, FALSE);
}
@@ -4464,10 +4539,11 @@ f_getreg(typval_T *argvars, typval_T *rettv)
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)))
+ && (check_for_opt_string_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && (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)
@@ -4526,6 +4602,9 @@ f_getregtype(typval_T *argvars, typval_T *rettv)
char_u buf[NUMBUFLEN + 2];
long reglen = 0;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
strregname = tv_get_string_chk(&argvars[0]);
@@ -4575,6 +4654,9 @@ f_gettagstack(typval_T *argvars, typval_T *rettv)
if (rettv_dict_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
wp = find_win_by_nr_or_id(&argvars[0]);
@@ -4591,6 +4673,9 @@ f_gettagstack(typval_T *argvars, typval_T *rettv)
static void
f_gettext(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_STRING
|| argvars[0].vval.v_string == NULL
|| *argvars[0].vval.v_string == NUL)
@@ -6023,6 +6108,12 @@ f_haslocaldir(typval_T *argvars, typval_T *rettv)
tabpage_T *tp = NULL;
win_T *wp = NULL;
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
wp = find_tabwin(&argvars[0], &argvars[1], &tp);
// Check for window-local and tab-local directories
@@ -6074,6 +6165,9 @@ f_hasmapto(typval_T *argvars, typval_T *rettv)
static void
f_hlID(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = syn_name2id(tv_get_string(&argvars[0]));
}
@@ -6083,6 +6177,9 @@ f_hlID(typval_T *argvars, typval_T *rettv)
static void
f_hlexists(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = highlight_exists(tv_get_string(&argvars[0]));
}
@@ -6214,6 +6311,13 @@ f_inputdialog(typval_T *argvars, typval_T *rettv)
char_u buf[NUMBUFLEN];
char_u *defstr = (char_u *)"";
+ 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_string_arg(argvars, 2) == FAIL)))
+ return;
+
message = tv_get_string_chk(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN
&& (defstr = tv_get_string_buf_chk(&argvars[1], buf)) != NULL)
@@ -6258,6 +6362,9 @@ f_inputlist(typval_T *argvars, typval_T *rettv)
if (no_console_input() && !is_not_a_term())
return;
#endif
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
{
semsg(_(e_listarg), "inputlist()");
@@ -6332,6 +6439,11 @@ f_inputsave(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_inputsecret(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
++cmdline_star;
++inputsecret_flag;
f_input(argvars, rettv);
@@ -6354,6 +6466,9 @@ f_interrupt(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
static void
f_invert(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = ~tv_get_number_chk(&argvars[0], NULL);
}
@@ -6585,6 +6700,9 @@ f_line2byte(typval_T *argvars UNUSED, typval_T *rettv)
#else
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
lnum = tv_get_lnum(argvars);
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
rettv->vval.v_number = -1;
@@ -6712,9 +6830,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
}
if (in_vim9script()
- && ((argvars[0].v_type != VAR_STRING
- && argvars[0].v_type != VAR_LIST
- && check_for_string_arg(argvars, 0) == FAIL)
+ && (check_for_string_or_list_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
@@ -6947,6 +7063,9 @@ max_min(typval_T *argvars, typval_T *rettv, int domax)
varnumber_T i;
int error = FALSE;
+ if (in_vim9script() && check_for_list_or_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_LIST)
{
list_T *l;
@@ -7052,6 +7171,10 @@ f_mzeval(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
str = tv_get_string_buf(&argvars[0], buf);
do_mzeval(str, rettv);
}
@@ -7078,6 +7201,9 @@ f_nextnonblank(typval_T *argvars, typval_T *rettv)
{
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
for (lnum = tv_get_lnum(argvars); ; ++lnum)
{
if (lnum < 0 || lnum > curbuf->b_ml.ml_line_count)
@@ -7130,6 +7256,11 @@ f_nr2char(typval_T *argvars, typval_T *rettv)
static void
f_or(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL)
| tv_get_number_chk(&argvars[1], NULL);
}
@@ -7144,6 +7275,9 @@ f_perleval(typval_T *argvars, typval_T *rettv)
char_u *str;
char_u buf[NUMBUFLEN];
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
str = tv_get_string_buf(&argvars[0], buf);
do_perleval(str, rettv);
}
@@ -7157,6 +7291,9 @@ f_prevnonblank(typval_T *argvars, typval_T *rettv)
{
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
lnum = tv_get_lnum(argvars);
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
lnum = 0;
@@ -7241,6 +7378,9 @@ f_py3eval(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (p_pyx == 0)
p_pyx = 3;
@@ -7262,6 +7402,9 @@ f_pyeval(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (p_pyx == 0)
p_pyx = 2;
@@ -7280,6 +7423,9 @@ f_pyxeval(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3)
init_pyxversion();
if (p_pyx == 2)
@@ -7300,6 +7446,9 @@ static int srand_seed_for_testing_is_used = FALSE;
static void
f_test_srand_seed(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
srand_seed_for_testing_is_used = FALSE;
else
@@ -7383,6 +7532,9 @@ f_rand(typval_T *argvars, typval_T *rettv)
listitem_T *lx, *ly, *lz, *lw;
UINT32_T x = 0, y, z, w, t, result;
+ if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
{
// When no argument is given use the global seed list.
@@ -7449,6 +7601,10 @@ f_srand(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) == FAIL)
return;
+
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
{
init_srand(&x);
@@ -7483,6 +7639,13 @@ f_range(typval_T *argvars, typval_T *rettv)
varnumber_T stride = 1;
int error = 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_number_arg(argvars, 2) == FAIL)))
+ return;
+
start = tv_get_number_chk(&argvars[0], &error);
if (argvars[1].v_type == VAR_UNKNOWN)
{
@@ -7551,6 +7714,9 @@ f_getreginfo(typval_T *argvars, typval_T *rettv)
dict_T *dict;
list_T *list;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
strregname = tv_get_string_chk(&argvars[0]);
@@ -7645,10 +7811,16 @@ f_rename(typval_T *argvars, typval_T *rettv)
{
char_u buf[NUMBUFLEN];
+ rettv->vval.v_number = -1;
if (check_restricted() || check_secure())
- rettv->vval.v_number = -1;
- else
- rettv->vval.v_number = vim_rename(tv_get_string(&argvars[0]),
+ return;
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
+ rettv->vval.v_number = vim_rename(tv_get_string(&argvars[0]),
tv_get_string_buf(&argvars[1], buf));
}
@@ -7666,10 +7838,8 @@ f_repeat(typval_T *argvars, typval_T *rettv)
int i;
if (in_vim9script()
- && (argvars[0].v_type != VAR_STRING
- && argvars[0].v_type != VAR_NUMBER
- && argvars[0].v_type != VAR_LIST
- && check_for_string_arg(argvars, 0) == FAIL))
+ && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
return;
n = (int)tv_get_number(&argvars[1]);
@@ -7932,6 +8102,9 @@ f_rubyeval(typval_T *argvars, typval_T *rettv)
char_u *str;
char_u buf[NUMBUFLEN];
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
str = tv_get_string_buf(&argvars[0], buf);
do_rubyeval(str, rettv);
}
@@ -7947,6 +8120,11 @@ f_screenattr(typval_T *argvars, typval_T *rettv)
int col;
int c;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
row = (int)tv_get_number_chk(&argvars[0], NULL) - 1;
col = (int)tv_get_number_chk(&argvars[1], NULL) - 1;
if (row < 0 || row >= screen_Rows
@@ -7968,6 +8146,11 @@ f_screenchar(typval_T *argvars, typval_T *rettv)
int off;
int c;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
row = (int)tv_get_number_chk(&argvars[0], NULL) - 1;
col = (int)tv_get_number_chk(&argvars[1], NULL) - 1;
if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns)
@@ -7997,6 +8180,12 @@ f_screenchars(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) == FAIL)
return;
+
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
row = (int)tv_get_number_chk(&argvars[0], NULL) - 1;
col = (int)tv_get_number_chk(&argvars[1], NULL) - 1;
if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns)
@@ -8053,6 +8242,11 @@ f_screenstring(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
row = (int)tv_get_number_chk(&argvars[0], NULL) - 1;
col = (int)tv_get_number_chk(&argvars[1], NULL) - 1;
if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns)
@@ -8515,6 +8709,9 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED)
dictitem_T *di;
char_u *csearch;
+ if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_DICT)
{
emsg(_(e_dictreq));
@@ -8593,6 +8790,12 @@ f_setfperm(typval_T *argvars, typval_T *rettv)
int mode = 0;
rettv->vval.v_number = 0;
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
fname = tv_get_string_chk(&argvars[0]);
if (fname == NULL)
return;
@@ -8900,6 +9103,9 @@ f_sha256(typval_T *argvars, typval_T *rettv)
{
char_u *p;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
p = tv_get_string(&argvars[0]);
rettv->vval.v_string = vim_strsave(
sha256_bytes(p, (int)STRLEN(p), NULL, 0));
@@ -8934,6 +9140,9 @@ f_shiftwidth(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->vval.v_number = 0;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
long col;
@@ -8958,6 +9167,9 @@ f_soundfold(typval_T *argvars, typval_T *rettv)
{
char_u *s;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
s = tv_get_string(&argvars[0]);
#ifdef FEAT_SPELL
@@ -8979,6 +9191,9 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
#ifdef FEAT_SPELL
int wo_spell_save = curwin->w_p_spell;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
if (!curwin->w_p_spell)
{
did_set_spelllang(curwin);
@@ -9298,6 +9513,9 @@ f_substitute(typval_T *argvars, typval_T *rettv)
static void
f_swapinfo(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (rettv_dict_alloc(rettv) == OK)
get_b0_dict(tv_get_string(argvars), rettv->vval.v_dict);
}
@@ -9311,6 +9529,10 @@ f_swapname(typval_T *argvars, typval_T *rettv)
buf_T *buf;
rettv->v_type = VAR_STRING;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
buf = tv_get_buf(&argvars[0], FALSE);
if (buf == NULL || buf->b_ml.ml_mfp == NULL
|| buf->b_ml.ml_mfp->mf_fname == NULL)
@@ -9460,6 +9682,9 @@ f_synIDtrans(typval_T *argvars UNUSED, typval_T *rettv)
int id;
#ifdef FEAT_SYN_HL
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
id = (int)tv_get_number(&argvars[0]);
if (id > 0)
@@ -9584,6 +9809,9 @@ f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
tabpage_T *tp;
win_T *wp = NULL;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
wp = firstwin;
else
@@ -9634,6 +9862,11 @@ f_taglist(typval_T *argvars, typval_T *rettv)
char_u *fname = NULL;
char_u *tag_pattern;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
tag_pattern = tv_get_string(&argvars[0]);
rettv->vval.v_number = FALSE;
@@ -9690,6 +9923,10 @@ f_virtcol(typval_T *argvars, typval_T *rettv)
int fnum = curbuf->b_fnum;
int len;
+ if (in_vim9script()
+ && check_for_string_or_list_arg(argvars, 0) == FAIL)
+ return;
+
fp = var2fpos(&argvars[0], FALSE, &fnum, FALSE);
if (fp != NULL && fp->lnum <= curbuf->b_ml.ml_line_count
&& fnum == curbuf->b_fnum)
@@ -9718,6 +9955,9 @@ f_visualmode(typval_T *argvars, typval_T *rettv)
{
char_u str[2];
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
str[0] = curbuf->b_visual_mode_eval;
str[1] = NUL;
@@ -9767,6 +10007,11 @@ f_wordcount(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_xor(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL)
^ tv_get_number_chk(&argvars[1], NULL);
}
diff --git a/src/evalwindow.c b/src/evalwindow.c
index d47680c75..737ca7dbd 100644
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -468,6 +468,9 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
// Information about one tab page
@@ -504,6 +507,9 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
wparg = win_id2wp(tv_get_number(&argvars[0]));
@@ -559,6 +565,10 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv)
if (rettv_list_alloc(rettv) == FAIL)
return;
+
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
#if defined(FEAT_GUI) \
|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \
|| defined(MSWIN)
@@ -624,6 +634,9 @@ f_tabpagenr(typval_T *argvars UNUSED, typval_T *rettv)
int nr = 1;
char_u *arg;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
arg = tv_get_string_chk(&argvars[0]);
@@ -672,9 +685,9 @@ f_tabpagewinnr(typval_T *argvars UNUSED, typval_T *rettv)
void
f_win_execute(typval_T *argvars, typval_T *rettv)
{
- int id = (int)tv_get_number(argvars);
+ int id;
tabpage_T *tp;
- win_T *wp = win_id2wp_tp(id, &tp);
+ win_T *wp;
win_T *save_curwin;
tabpage_T *save_curtab;
@@ -682,6 +695,14 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_string_or_list_arg(argvars, 1) == FAIL
+ || check_for_opt_string_arg(argvars, 2) == FAIL))
+ return;
+
+ id = (int)tv_get_number(argvars);
+ wp = win_id2wp_tp(id, &tp);
if (wp != NULL && tp != NULL)
{
pos_T curpos = wp->w_cursor;
@@ -705,6 +726,9 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
void
f_win_findbuf(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
if (rettv_list_alloc(rettv) != FAIL)
win_findbuf(argvars, rettv->vval.v_list);
}
@@ -715,6 +739,12 @@ f_win_findbuf(typval_T *argvars, typval_T *rettv)
void
f_win_getid(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
rettv->vval.v_number = win_getid(argvars);
}
@@ -726,8 +756,12 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
tabpage_T *tp;
- int id = tv_get_number(&argvars[0]);
+ int id;
+
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+ id = tv_get_number(&argvars[0]);
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
{
@@ -750,6 +784,9 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv)
void
f_win_id2tabwin(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
if (rettv_list_alloc(rettv) != FAIL)
win_id2tabwin(argvars, rettv->vval.v_list);
}
@@ -760,6 +797,9 @@ f_win_id2tabwin(typval_T *argvars, typval_T *rettv)
void
f_win_id2win(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = win_id2win(argvars);
}
@@ -774,6 +814,9 @@ f_win_screenpos(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) == FAIL)
return;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1);
list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1);
@@ -883,6 +926,10 @@ f_win_gettype(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
wp = find_win_by_nr_or_id(&argvars[0]);
@@ -934,6 +981,9 @@ f_winbufnr(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
if (wp == NULL)
rettv->vval.v_number = -1;
@@ -959,6 +1009,9 @@ f_winheight(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
if (wp == NULL)
rettv->vval.v_number = -1;
@@ -977,6 +1030,9 @@ f_winlayout(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
tp = curtab;
else
@@ -1007,6 +1063,9 @@ f_winnr(typval_T *argvars UNUSED, typval_T *rettv)
{
int nr = 1;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
nr = get_winnr(curtab, &argvars[0]);
rettv->vval.v_number = nr;
}
@@ -1052,6 +1111,9 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED)
{
dict_T *dict;
+ if (in_vim9script() && check_for_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_DICT
|| (dict = argvars[0].vval.v_dict) == NULL)
emsg(_(e_invarg));
@@ -1129,6 +1191,9 @@ f_winwidth(typval_T *argvars, typval_T *rettv)
{
win_T *wp;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
if (wp == NULL)
rettv->vval.v_number = -1;
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 2f1fdb604..fbfba52dd 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3808,11 +3808,16 @@ cmd_exists(char_u *name)
f_fullcommand(typval_T *argvars, typval_T *rettv)
{
exarg_T ea;
- char_u *name = argvars[0].vval.v_string;
+ char_u *name;
char_u *p;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ name = argvars[0].vval.v_string;
if (name == NULL)
return;
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 40b8886a0..ad0f07e3f 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4061,8 +4061,12 @@ set_cmdline_pos(
void
f_setcmdpos(typval_T *argvars, typval_T *rettv)
{
- int pos = (int)tv_get_number(&argvars[0]) - 1;
+ int pos;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ pos = (int)tv_get_number(&argvars[0]) - 1;
if (pos >= 0)
rettv->vval.v_number = set_cmdline_pos(pos);
}
@@ -4517,7 +4521,7 @@ get_user_input(
int inputdialog,
int secret)
{
- char_u *prompt = tv_get_string_chk(&argvars[0]);
+ char_u *prompt;
char_u *p = NULL;
int c;
char_u buf[NUMBUFLEN];
@@ -4531,6 +4535,15 @@ get_user_input(
if (input_busy)
return; // this doesn't work recursively.
+ 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_string_arg(argvars, 2) == FAIL)))
+ return;
+
+ prompt = tv_get_string_chk(&argvars[0]);
+
#ifdef NO_CONSOLE_INPUT
// While starting up, there is no place to enter text. When running tests
// with --not-a-term we assume feedkeys() will be used.
diff --git a/src/filepath.c b/src/filepath.c
index 989f56e53..74ee2ec15 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -834,6 +834,11 @@ f_delete(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
name = tv_get_string(&argvars[0]);
if (name == NULL || *name == NUL)
{
@@ -899,6 +904,7 @@ f_filereadable(typval_T *argvars, typval_T *rettv)
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
+
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
@@ -946,7 +952,11 @@ findfilendir(
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
- if (in_vim9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL)
+ if (in_vim9script()
+ && (check_for_nonempty_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 2) == FAIL)))
return;
#ifdef FEAT_SEARCHPATH
@@ -1027,9 +1037,11 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv)
char_u *fbuf = NULL;
char_u buf[NUMBUFLEN];
- if (in_vim9script() && (check_for_string_arg(argvars, 0) == FAIL
- || check_for_string_arg(argvars, 1) == FAIL))
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
return;
+
fname = tv_get_string_chk(&argvars[0]);
mods = tv_get_string_buf_chk(&argvars[1], buf);
if (mods == NULL || fname == NULL)
@@ -1077,6 +1089,12 @@ f_getcwd(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+ if (in_vim9script()
+ && (check_for_opt_number_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 1) == FAIL)))
+ return;
+
if (argvars[0].v_type == VAR_NUMBER
&& argvars[0].vval.v_number == -1
&& argvars[1].v_type == VAR_UNKNOWN)
@@ -1141,6 +1159,7 @@ f_getfperm(typval_T *argvars, typval_T *rettv)
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
+
fname = tv_get_string(&argvars[0]);
rettv->v_type = VAR_STRING;
@@ -1190,6 +1209,7 @@ f_getftime(typval_T *argvars, typval_T *rettv)
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
+
fname = tv_get_string(&argvars[0]);
if (mch_stat((char *)fname, &st) >= 0)
rettv->vval.v_number = (varnumber_T)st.st_mtime;
@@ -1236,6 +1256,7 @@ f_getftype(typval_T *argvars, typval_T *rettv)
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
+
fname = tv_get_string(&argvars[0]);
rettv->v_type = VAR_STRING;
@@ -1311,9 +1332,12 @@ f_glob(typval_T *argvars, typval_T *rettv)
f_glob2regpat(typval_T *argvars, typval_T *rettv)
{
char_u buf[NUMBUFLEN];
- char_u *pat = tv_get_string_buf_chk_strict(&argvars[0], buf,
- in_vim9script());
+ char_u *pat;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+ pat = tv_get_string_buf_chk_strict(&argvars[0], buf, in_vim9script());
rettv->v_type = VAR_STRING;
rettv->vval.v_string = (pat == NULL)
? NULL : file_pat_to_reg_pat(pat, NULL, NULL, FALSE);
@@ -1382,6 +1406,9 @@ f_globpath(typval_T *argvars, typval_T *rettv)
void
f_isdirectory(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = mch_isdir(tv_get_string(&argvars[0]));
}
@@ -1429,6 +1456,13 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure())
return;
+ if (in_vim9script()
+ && (check_for_nonempty_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 2) == FAIL)))
+ return;
+
dir = tv_get_string_buf(&argvars[0], buf);
if (*dir == NUL)
return;
@@ -1919,6 +1953,9 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob)
void
f_readblob(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
read_file_or_blob(argvars, rettv, TRUE);
}
@@ -1928,6 +1965,13 @@ f_readblob(typval_T *argvars, typval_T *rettv)
void
f_readfile(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_nonempty_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_opt_number_arg(argvars, 2) == FAIL)))
+ return;
+
read_file_or_blob(argvars, rettv, FALSE);
}
@@ -1942,6 +1986,9 @@ f_resolve(typval_T *argvars, typval_T *rettv)
char_u *buf = NULL;
#endif
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
p = tv_get_string(&argvars[0]);
#ifdef FEAT_SHORTCUT
{
@@ -2497,6 +2544,11 @@ f_browsedir(typval_T *argvars UNUSED, typval_T *rettv)
char_u *initdir;
char_u buf[NUMBUFLEN];
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
title = tv_get_string_chk(&argvars[0]);
initdir = tv_get_string_buf_chk(&argvars[1], buf);
diff --git a/src/findfile.c b/src/findfile.c
index 7c2a61f4a..b79b1d1db 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -2857,6 +2857,9 @@ f_simplify(typval_T *argvars, typval_T *rettv)
{
char_u *p;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
p = tv_get_string_strict(&argvars[0]);
rettv->vval.v_string = vim_strsave(p);
simplify_filename(rettv->vval.v_string); // simplify in place
diff --git a/src/float.c b/src/float.c
index 7c020448a..898095fd4 100644
--- a/src/float.c
+++ b/src/float.c
@@ -82,6 +82,9 @@ get_float_arg(typval_T *argvars, float_T *f)
void
f_abs(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_FLOAT)
{
rettv->v_type = VAR_FLOAT;
@@ -110,6 +113,9 @@ f_acos(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = acos(f);
@@ -125,6 +131,9 @@ f_asin(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = asin(f);
@@ -140,6 +149,9 @@ f_atan(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = atan(f);
@@ -155,6 +167,11 @@ f_atan2(typval_T *argvars, typval_T *rettv)
{
float_T fx = 0.0, fy = 0.0;
+ if (in_vim9script()
+ && (check_for_float_or_nr_arg(argvars, 0) == FAIL
+ || check_for_float_or_nr_arg(argvars, 1) == FAIL))
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &fx) == OK
&& get_float_arg(&argvars[1], &fy) == OK)
@@ -171,6 +188,9 @@ f_ceil(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = ceil(f);
@@ -186,6 +206,9 @@ f_cos(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = cos(f);
@@ -201,6 +224,9 @@ f_cosh(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = cosh(f);
@@ -216,6 +242,9 @@ f_exp(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = exp(f);
@@ -231,6 +260,9 @@ f_float2nr(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
if (get_float_arg(argvars, &f) == OK)
{
if (f <= (float_T)-VARNUM_MAX + DBL_EPSILON)
@@ -250,6 +282,9 @@ f_floor(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = floor(f);
@@ -265,6 +300,11 @@ f_fmod(typval_T *argvars, typval_T *rettv)
{
float_T fx = 0.0, fy = 0.0;
+ if (in_vim9script()
+ && (check_for_float_or_nr_arg(argvars, 0) == FAIL
+ || check_for_float_or_nr_arg(argvars, 1) == FAIL))
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &fx) == OK
&& get_float_arg(&argvars[1], &fy) == OK)
@@ -280,6 +320,9 @@ f_fmod(typval_T *argvars, typval_T *rettv)
void
f_isinf(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_FLOAT && isinf(argvars[0].vval.v_float))
rettv->vval.v_number = argvars[0].vval.v_float > 0.0 ? 1 : -1;
}
@@ -290,6 +333,9 @@ f_isinf(typval_T *argvars, typval_T *rettv)
void
f_isnan(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = argvars[0].v_type == VAR_FLOAT
&& isnan(argvars[0].vval.v_float);
}
@@ -303,6 +349,9 @@ f_log(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = log(f);
@@ -318,6 +367,9 @@ f_log10(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = log10(f);
@@ -333,6 +385,11 @@ f_pow(typval_T *argvars, typval_T *rettv)
{
float_T fx = 0.0, fy = 0.0;
+ if (in_vim9script()
+ && (check_for_float_or_nr_arg(argvars, 0) == FAIL
+ || check_for_float_or_nr_arg(argvars, 1) == FAIL))
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &fx) == OK
&& get_float_arg(&argvars[1], &fy) == OK)
@@ -359,6 +416,9 @@ f_round(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = vim_round(f);
@@ -374,6 +434,9 @@ f_sin(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = sin(f);
@@ -389,6 +452,9 @@ f_sinh(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = sinh(f);
@@ -404,6 +470,9 @@ f_sqrt(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = sqrt(f);
@@ -417,8 +486,14 @@ f_sqrt(typval_T *argvars, typval_T *rettv)
void
f_str2float(typval_T *argvars, typval_T *rettv)
{
- char_u *p = skipwhite(tv_get_string_strict(&argvars[0]));
- int isneg = (*p == '-');
+ char_u *p;
+ int isneg;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ p = skipwhite(tv_get_string_strict(&argvars[0]));
+ isneg = (*p == '-');
if (*p == '+' || *p == '-')
p = skipwhite(p + 1);
@@ -436,6 +511,9 @@ f_tan(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = tan(f);
@@ -451,6 +529,9 @@ f_tanh(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
rettv->vval.v_float = tanh(f);
@@ -466,6 +547,9 @@ f_trunc(typval_T *argvars, typval_T *rettv)
{
float_T f = 0.0;
+ if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
// trunc() is not in C90, use floor() or ceil() instead.
diff --git a/src/fold.c b/src/fold.c
index f10294d75..d9cba6a22 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -3658,6 +3658,9 @@ foldclosed_both(
linenr_T lnum;
linenr_T first, last;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
{
@@ -3701,6 +3704,9 @@ f_foldlevel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
# ifdef FEAT_FOLDING
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
rettv->vval.v_number = foldLevel(lnum);
@@ -3789,6 +3795,10 @@ f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
# ifdef FEAT_FOLDING
if (entered)
return; // reject recursive use
diff --git a/src/getchar.c b/src/getchar.c
index 39aee22f8..196a3aeeb 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2025,6 +2025,9 @@ getchar_common(typval_T *argvars, typval_T *rettv)
varnumber_T n;
int error = FALSE;
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+
#ifdef MESSAGE_QUEUE
// vpeekc() used to check for messages, but that caused problems, invoking
// a callback where it was not expected. Some plugins use getchar(1) in a
diff --git a/src/indent.c b/src/indent.c
index ed7ce97f1..89653c777 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2098,6 +2098,9 @@ f_indent(typval_T *argvars, typval_T *rettv)
{
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
rettv->vval.v_number = get_indent_lnum(lnum);
@@ -2115,6 +2118,9 @@ f_lispindent(typval_T *argvars UNUSED, typval_T *rettv)
pos_T pos;
linenr_T lnum;
+ if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL)
+ return;
+
pos = curwin->w_cursor;
lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
diff --git a/src/insexpand.c b/src/insexpand.c
index 1eebfd281..3b58891fc 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2473,10 +2473,7 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED)
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))
+ if (in_vim9script() && check_for_string_or_dict_arg(argvars, 0) == FAIL)
return;
rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, FALSE);
@@ -2666,6 +2663,9 @@ f_complete_info(typval_T *argvars, typval_T *rettv)
if (rettv_dict_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (argvars[0].v_type != VAR_LIST)
diff --git a/src/job.c b/src/job.c
index 1f9024495..892d237a3 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1714,6 +1714,9 @@ f_prompt_getprompt(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
buf = tv_get_buf_from_arg(&argvars[0]);
if (buf == NULL)
return;
@@ -1776,8 +1779,12 @@ get_job_arg(typval_T *tv)
void
f_job_getchannel(typval_T *argvars, typval_T *rettv)
{
- job_T *job = get_job_arg(&argvars[0]);
+ job_T *job;
+
+ if (in_vim9script() && check_for_job_arg(argvars, 0) == FAIL)
+ return;
+ job = get_job_arg(&argvars[0]);
if (job != NULL)
{
rettv->v_type = VAR_CHANNEL;
@@ -1864,10 +1871,14 @@ job_info_all(list_T *l)
void
f_job_info(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_opt_job_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
- job_T *job = get_job_arg(&argvars[0]);
+ job_T *job;
+ job = get_job_arg(&argvars[0]);
if (job != NULL && rettv_dict_alloc(rettv) != FAIL)
job_info(job, rettv->vval.v_dict);
}
@@ -1922,6 +1933,9 @@ f_job_start(typval_T *argvars, typval_T *rettv)
void
f_job_status(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_job_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_JOB && argvars[0].vval.v_job == NULL)
{
// A job that never started returns "fail".
diff --git a/src/json.c b/src/json.c
index d0a087a92..4b9a2e825 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1156,6 +1156,9 @@ f_js_decode(typval_T *argvars, typval_T *rettv)
{
js_read_T reader;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
reader.js_buf = tv_get_string(&argvars[0]);
reader.js_fill = NULL;
reader.js_used = 0;
@@ -1181,6 +1184,9 @@ f_json_decode(typval_T *argvars, typval_T *rettv)
{
js_read_T reader;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
reader.js_buf = tv_get_string(&argvars[0]);
reader.js_fill = NULL;
reader.js_used = 0;
diff --git a/src/list.c b/src/list.c
index 7f607be3c..c65c8df6f 100644
--- a/src/list.c
+++ b/src/list.c
@@ -2528,10 +2528,7 @@ f_count(typval_T *argvars, typval_T *rettv)
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_string_or_list_or_dict_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)))
diff --git a/src/mark.c b/src/mark.c
index b5f2a7e80..d60676312 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -1510,6 +1510,9 @@ f_getmarklist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
{
get_global_marks(rettv->vval.v_list);
diff --git a/src/match.c b/src/match.c
index 8bb8ccc9c..b5762fca2 100644
--- a/src/match.c
+++ b/src/match.c
@@ -959,8 +959,12 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#ifdef FEAT_SEARCH_EXTRA
- win_T *win = get_optional_window(argvars, 0);
+ win_T *win;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
+ win = get_optional_window(argvars, 0);
if (win != NULL)
clear_matches(win);
#endif
@@ -976,8 +980,12 @@ f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
dict_T *dict;
matchitem_T *cur;
int i;
- win_T *win = get_optional_window(argvars, 0);
+ win_T *win;
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
+ win = get_optional_window(argvars, 0);
if (rettv_list_alloc(rettv) == FAIL || win == NULL)
return;
@@ -1288,9 +1296,13 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
if (rettv_list_alloc(rettv) == OK)
{
# ifdef FEAT_SEARCH_EXTRA
- int id = (int)tv_get_number(&argvars[0]);
+ int id;
matchitem_T *m;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = (int)tv_get_number(&argvars[0]);
if (id >= 1 && id <= 3)
{
if ((m = (matchitem_T *)get_match(curwin, id)) != NULL)
@@ -1316,8 +1328,14 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
# ifdef FEAT_SEARCH_EXTRA
- win_T *win = get_optional_window(argvars, 1);
+ win_T *win;
+
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_opt_number_arg(argvars, 1) == FAIL))
+ return;
+ win = get_optional_window(argvars, 1);
if (win == NULL)
rettv->vval.v_number = -1;
else
diff --git a/src/mbyte.c b/src/mbyte.c
index 3d5ad7636..a626f50c6 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4977,6 +4977,12 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv)
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_string_arg(argvars, 2) == FAIL))
+ return;
+
str = tv_get_string(&argvars[0]);
from = enc_canonize(enc_skip(tv_get_string_buf(&argvars[1], buf1)));
to = enc_canonize(enc_skip(tv_get_string_buf(&argvars[2], buf2)));
@@ -5505,6 +5511,9 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
listitem_T **ptrs;
cw_interval_T *table;
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
{
emsg(_(e_listreq));
diff --git a/src/menu.c b/src/menu.c
index fb4be218b..b9f7db2c0 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -2941,6 +2941,11 @@ f_menu_info(typval_T *argvars, typval_T *rettv)
return;
retdict = rettv->vval.v_dict;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
menu_name = tv_get_string_chk(&argvars[0]);
if (menu_name == NULL)
return;
diff --git a/src/misc1.c b/src/misc1.c
index b6325dc27..e66f5a85d 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -632,6 +632,9 @@ f_mode(typval_T *argvars, typval_T *rettv)
{
char_u buf[4];
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+
CLEAR_FIELD(buf);
if (time_for_testing == 93784)
@@ -733,6 +736,9 @@ f_state(typval_T *argvars, typval_T *rettv)
char_u *include = NULL;
int i;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
ga_init2(&ga, 1, 20);
if (argvars[0].v_type != VAR_UNKNOWN)
include = tv_get_string(&argvars[0]);
@@ -2353,7 +2359,7 @@ get_cmd_output_as_rettv(
if (in_vim9script()
&& (check_for_string_arg(argvars, 0) == FAIL
- || check_for_opt_string_or_number_arg(argvars, 1) == FAIL))
+ || check_for_string_or_number_or_list_arg(argvars, 1) == FAIL))
return;
if (argvars[1].v_type != VAR_UNKNOWN)
diff --git a/src/move.c b/src/move.c
index 21e2a5d46..20a1a257e 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1286,6 +1286,12 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv)
return;
dict = rettv->vval.v_dict;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL
+ || check_for_number_arg(argvars, 2) == FAIL))
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
if (wp == NULL)
return;
diff --git a/src/popupwin.c b/src/popupwin.c
index 97c8fe5c2..470bd7015 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1851,6 +1851,11 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
int nr;
int i;
+ if (in_vim9script()
+ && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL
+ || check_for_dict_arg(argvars, 1) == FAIL))
+ return NULL;
+
if (argvars != NULL)
{
// Check that arguments look OK.
@@ -2141,6 +2146,9 @@ f_popup_clear(typval_T *argvars, typval_T *rettv UNUSED)
{
int force = FALSE;
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
force = (int)tv_get_bool(&argvars[0]);
close_all_popups(force);
@@ -2558,9 +2566,14 @@ popup_hide(win_T *wp)
void
f_popup_hide(typval_T *argvars, typval_T *rettv UNUSED)
{
- int id = (int)tv_get_number(argvars);
- win_T *wp = find_popup_win(id);
+ int id;
+ win_T *wp;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = (int)tv_get_number(argvars);
+ wp = find_popup_win(id);
if (wp != NULL)
popup_hide(wp);
}
@@ -2582,9 +2595,14 @@ popup_show(win_T *wp)
void
f_popup_show(typval_T *argvars, typval_T *rettv UNUSED)
{
- int id = (int)tv_get_number(argvars);
- win_T *wp = find_popup_win(id);
+ int id;
+ win_T *wp;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = (int)tv_get_number(argvars);
+ wp = find_popup_win(id);
if (wp != NULL)
{
popup_show(wp);
@@ -2824,13 +2842,18 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
f_popup_getpos(typval_T *argvars, typval_T *rettv)
{
dict_T *dict;
- int id = (int)tv_get_number(argvars);
- win_T *wp = find_popup_win(id);
+ int id;
+ win_T *wp;
int top_extra;
int left_extra;
if (rettv_dict_alloc(rettv) == OK)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = (int)tv_get_number(argvars);
+ wp = find_popup_win(id);
if (wp == NULL)
return; // invalid {id}
top_extra = popup_top_extra(wp);
@@ -2886,10 +2909,17 @@ f_popup_list(typval_T *argvars UNUSED, typval_T *rettv)
void
f_popup_locate(typval_T *argvars, typval_T *rettv)
{
- int row = tv_get_number(&argvars[0]) - 1;
- int col = tv_get_number(&argvars[1]) - 1;
+ int row;
+ int col;
win_T *wp;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
+ row = tv_get_number(&argvars[0]) - 1;
+ col = tv_get_number(&argvars[1]) - 1;
wp = mouse_find_win(&row, &col, FIND_POPUP);
if (wp != NULL && WIN_IS_POPUP(wp))
rettv->vval.v_number = wp->w_id;
@@ -3003,13 +3033,18 @@ get_moved_list(dict_T *dict, win_T *wp)
f_popup_getoptions(typval_T *argvars, typval_T *rettv)
{
dict_T *dict;
- int id = (int)tv_get_number(argvars);
- win_T *wp = find_popup_win(id);
+ int id;
+ win_T *wp;
tabpage_T *tp;
int i;
if (rettv_dict_alloc(rettv) == OK)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = (int)tv_get_number(argvars);
+ wp = find_popup_win(id);
if (wp == NULL)
return;
diff --git a/src/proto/typval.pro b/src/proto/typval.pro
index b6248afc8..9b5af699d 100644
--- a/src/proto/typval.pro
+++ b/src/proto/typval.pro
@@ -24,6 +24,7 @@ int check_for_opt_dict_arg(typval_T *args, int idx);
int check_for_chan_or_job_arg(typval_T *args, int idx);
int check_for_opt_chan_or_job_arg(typval_T *args, int idx);
int check_for_job_arg(typval_T *args, int idx);
+int check_for_opt_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_opt_buffer_arg(typval_T *args, int idx);
@@ -33,9 +34,13 @@ 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);
int check_for_string_or_list_arg(typval_T *args, int idx);
int check_for_opt_string_or_list_arg(typval_T *args, int idx);
+int check_for_string_or_dict_arg(typval_T *args, int idx);
+int check_for_string_or_number_or_list_arg(typval_T *args, int idx);
+int check_for_string_or_list_or_dict_arg(typval_T *args, int idx);
int check_for_list_or_blob_arg(typval_T *args, int idx);
+int check_for_list_or_dict_arg(typval_T *args, int idx);
int check_for_list_or_dict_or_blob_arg(typval_T *args, int idx);
-int check_for_buffer_or_dict_arg(typval_T *args, int idx);
+int check_for_opt_buffer_or_dict_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);
diff --git a/src/quickfix.c b/src/quickfix.c
index d1671b23e..7cc83e3ed 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -8370,6 +8370,11 @@ f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
# ifdef FEAT_QUICKFIX
win_T *wp;
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
+
wp = find_win_by_nr_or_id(&argvars[0]);
get_qf_loc_list(FALSE, wp, &argvars[1], rettv);
# endif
@@ -8382,6 +8387,9 @@ f_getloclist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_getqflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
# ifdef FEAT_QUICKFIX
+ if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
+ return;
+
get_qf_loc_list(TRUE, NULL, &argvars[0], rettv);
# endif
}
diff --git a/src/search.c b/src/search.c
index 0034e1e9f..aa16d4484 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4111,6 +4111,9 @@ f_searchcount(typval_T *argvars, typval_T *rettv)
if (rettv_dict_alloc(rettv) == FAIL)
return;
+ if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (shortmess(SHM_SEARCHCOUNT)) // 'shortmess' contains 'S' flag
recompute = TRUE;
diff --git a/src/sign.c b/src/sign.c
index 85c8d1493..9aded72a7 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -2278,6 +2278,9 @@ f_sign_getdefined(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc_id(rettv, aid_sign_getdefined) != OK)
return;
+ if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
@@ -2573,6 +2576,9 @@ f_sign_placelist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_LIST)
{
emsg(_(e_listreq));
@@ -2620,6 +2626,10 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv)
{
char_u *name;
+ if (in_vim9script()
+ && check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
{
// Undefine multiple signs
@@ -2761,6 +2771,11 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_STRING)
{
emsg(_(e_invarg));
@@ -2792,6 +2807,9 @@ f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_LIST)
{
emsg(_(e_listreq));
diff --git a/src/sound.c b/src/sound.c
index f857c8725..e704aed69 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -246,6 +246,9 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv)
void
f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
if (context != NULL)
ca_context_cancel(context, tv_get_number(&argvars[0]));
}
@@ -427,9 +430,13 @@ failure:
void
f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
{
- long id = tv_get_number(&argvars[0]);
+ long id;
char buf[32];
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
+ id = tv_get_number(&argvars[0]);
vim_snprintf(buf, sizeof(buf), "stop sound%06ld", id);
mciSendString(buf, NULL, 0, NULL);
}
diff --git a/src/strings.c b/src/strings.c
index bc0fc5e31..f4b83d908 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -853,6 +853,12 @@ f_charidx(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL
+ || check_for_opt_bool_arg(argvars, 2) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_STRING || argvars[1].v_type != VAR_NUMBER
|| (argvars[2].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_NUMBER
@@ -948,6 +954,13 @@ f_str2nr(typval_T *argvars, typval_T *rettv)
int what = 0;
int isneg;
+ 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 (argvars[1].v_type != VAR_UNKNOWN)
{
base = (int)tv_get_number(&argvars[1]);
@@ -1031,6 +1044,12 @@ f_stridx(typval_T *argvars, typval_T *rettv)
char_u *pos;
int start_idx;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL
+ || check_for_opt_number_arg(argvars, 2) == FAIL))
+ return;
+
needle = tv_get_string_chk(&argvars[1]);
save_haystack = haystack = tv_get_string_buf_chk(&argvars[0], buf);
rettv->vval.v_number = -1;
@@ -1076,6 +1095,10 @@ f_string(typval_T *argvars, typval_T *rettv)
void
f_strlen(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && check_for_string_or_number_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = (varnumber_T)(STRLEN(
tv_get_string(&argvars[0])));
}
@@ -1102,6 +1125,10 @@ strchar_common(typval_T *argvars, typval_T *rettv, int skipcc)
void
f_strcharlen(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && check_for_string_or_number_arg(argvars, 0) == FAIL)
+ return;
+
strchar_common(argvars, rettv, TRUE);
}
@@ -1155,8 +1182,12 @@ f_strdisplaywidth(typval_T *argvars, typval_T *rettv)
void
f_strwidth(typval_T *argvars, typval_T *rettv)
{
- char_u *s = tv_get_string_strict(&argvars[0]);
+ char_u *s;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ s = tv_get_string_strict(&argvars[0]);
rettv->vval.v_number = (varnumber_T)(mb_string2cells(s, -1));
}
@@ -1326,6 +1357,12 @@ f_strridx(typval_T *argvars, typval_T *rettv)
char_u *lastmatch = NULL;
int haystack_len, end_idx;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL
+ || check_for_opt_number_arg(argvars, 2) == FAIL))
+ return;
+
needle = tv_get_string_chk(&argvars[1]);
haystack = tv_get_string_buf_chk(&argvars[0], buf);
@@ -1372,6 +1409,9 @@ f_strridx(typval_T *argvars, typval_T *rettv)
void
f_strtrans(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
rettv->vval.v_string = transstr(tv_get_string(&argvars[0]));
}
@@ -1382,6 +1422,9 @@ f_strtrans(typval_T *argvars, typval_T *rettv)
void
f_tolower(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
rettv->vval.v_string = strlow_save(tv_get_string(&argvars[0]));
}
@@ -1392,6 +1435,9 @@ f_tolower(typval_T *argvars, typval_T *rettv)
void
f_toupper(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
rettv->vval.v_string = strup_save(tv_get_string(&argvars[0]));
}
@@ -1417,6 +1463,12 @@ f_tr(typval_T *argvars, typval_T *rettv)
char_u buf2[NUMBUFLEN];
garray_T ga;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL
+ || check_for_string_arg(argvars, 2) == FAIL))
+ return;
+
in_str = tv_get_string(&argvars[0]);
fromstr = tv_get_string_buf_chk(&argvars[1], buf);
tostr = tv_get_string_buf_chk(&argvars[2], buf2);
@@ -1517,7 +1569,7 @@ f_trim(typval_T *argvars, typval_T *rettv)
{
char_u buf1[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
- char_u *head = tv_get_string_buf_chk(&argvars[0], buf1);
+ char_u *head;
char_u *mask = NULL;
char_u *tail;
char_u *prev;
@@ -1527,6 +1579,15 @@ f_trim(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
+
+ 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_number_arg(argvars, 2) == FAIL)))
+ return;
+
+ head = tv_get_string_buf_chk(&argvars[0], buf1);
if (head == NULL)
return;
diff --git a/src/terminal.c b/src/terminal.c
index 98b46004e..d0d791c78 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -5284,11 +5284,6 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
FILE *fd2 = NULL;
char_u *textline = NULL;
- if (in_vim9script()
- && (check_for_string_arg(argvars, 0) == FAIL
- || check_for_dict_arg(argvars, 1) == FAIL))
- return;
-
// First open the files. If this fails bail out.
fname1 = tv_get_string_buf_chk(&argvars[0], buf1);
if (do_diff)
@@ -5666,6 +5661,11 @@ f_term_dumpdiff(typval_T *argvars, typval_T *rettv)
void
f_term_dumpload(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_dict_arg(argvars, 1) == FAIL))
+ return;
+
term_load_dump(argvars, rettv, FALSE);
}
@@ -5675,8 +5675,12 @@ f_term_dumpload(typval_T *argvars, typval_T *rettv)
void
f_term_getaltscreen(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getaltscreen()");
+ buf_T *buf;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+ buf = term_get_buf(argvars, "term_getaltscreen()");
if (buf == NULL)
return;
rettv->vval.v_number = buf->b_term->tl_using_altscreen;
@@ -5729,13 +5733,18 @@ f_term_getattr(typval_T *argvars, typval_T *rettv)
void
f_term_getcursor(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getcursor()");
+ buf_T *buf;
term_T *term;
list_T *l;
dict_T *d;
if (rettv_list_alloc(rettv) == FAIL)
return;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = term_get_buf(argvars, "term_getcursor()");
if (buf == NULL)
return;
term = buf->b_term;
@@ -5762,8 +5771,12 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
void
f_term_getjob(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getjob()");
+ buf_T *buf;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+ buf = term_get_buf(argvars, "term_getjob()");
if (buf == NULL)
{
rettv->v_type = VAR_SPECIAL;
@@ -5847,8 +5860,12 @@ f_term_getline(typval_T *argvars, typval_T *rettv)
void
f_term_getscrolled(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getscrolled()");
+ buf_T *buf;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+ buf = term_get_buf(argvars, "term_getscrolled()");
if (buf == NULL)
return;
rettv->vval.v_number = buf->b_term->tl_scrollback_scrolled;
@@ -5860,11 +5877,16 @@ f_term_getscrolled(typval_T *argvars, typval_T *rettv)
void
f_term_getsize(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getsize()");
+ buf_T *buf;
list_T *l;
if (rettv_list_alloc(rettv) == FAIL)
return;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = term_get_buf(argvars, "term_getsize()");
if (buf == NULL)
return;
@@ -5916,11 +5938,16 @@ f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
void
f_term_getstatus(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getstatus()");
+ buf_T *buf;
term_T *term;
char_u val[100];
rettv->v_type = VAR_STRING;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = term_get_buf(argvars, "term_getstatus()");
if (buf == NULL)
return;
term = buf->b_term;
@@ -5940,9 +5967,14 @@ f_term_getstatus(typval_T *argvars, typval_T *rettv)
void
f_term_gettitle(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_gettitle()");
+ buf_T *buf;
rettv->v_type = VAR_STRING;
+
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = term_get_buf(argvars, "term_gettitle()");
if (buf == NULL)
return;
@@ -6179,7 +6211,7 @@ f_term_sendkeys(typval_T *argvars, typval_T *rettv UNUSED)
void
f_term_getansicolors(typval_T *argvars, typval_T *rettv)
{
- buf_T *buf = term_get_buf(argvars, "term_getansicolors()");
+ buf_T *buf;
term_T *term;
VTermState *state;
VTermColor color;
@@ -6190,6 +6222,10 @@ f_term_getansicolors(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) == FAIL)
return;
+ if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL)
+ return;
+
+ buf = term_get_buf(argvars, "term_getansicolors()");
if (buf == NULL)
return;
term = buf->b_term;
@@ -6218,9 +6254,8 @@ f_term_setansicolors(typval_T *argvars, typval_T *rettv UNUSED)
term_T *term;
if (in_vim9script()
- && (check_for_opt_buffer_arg(argvars, 0) == FAIL
- || (argvars[0].v_type != VAR_UNKNOWN
- && check_for_opt_list_arg(argvars, 1) == FAIL)))
+ && (check_for_buffer_arg(argvars, 0) == FAIL
+ || check_for_list_arg(argvars, 1) == FAIL))
return;
buf = term_get_buf(argvars, "term_setansicolors()");
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
index 51a0a3e66..8987f3f8d 100644
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -268,7 +268,7 @@ func Test_assert_fail_fails()
catch
let exp = v:exception
endtry
- call assert_match("E1174: String required for argument 2", exp)
+ call assert_match("E1222: String or List required for argument 2", exp)
try
call assert_equal(1, assert_fails('xxx', 'E492', '', 'burp'))
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim
index a8d8da0c5..b41ca78f3 100644
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -363,7 +363,7 @@ func Test_blob_add()
VAR b = 0z0011
call add("", 0x01)
END
- call CheckLegacyAndVim9Failure(lines, ['E897:', 'E1013:', 'E1211:'])
+ call CheckLegacyAndVim9Failure(lines, ['E897:', 'E1013:', 'E1226:'])
let lines =<< trim END
add(test_null_blob(), 0x22)
diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim
index aa73e0f31..2652ba170 100644
--- a/src/testdir/test_execute_func.vim
+++ b/src/testdir/test_execute_func.vim
@@ -40,7 +40,7 @@ func Test_execute_string()
if has('float')
call assert_fails('call execute(3.4)', 'E492:')
call assert_equal("\nx", execute("echo \"x\"", 3.4))
- call CheckDefExecAndScriptFailure2(['execute("echo \"x\"", 3.4)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E806:')
+ call CheckDefExecAndScriptFailure2(['execute("echo \"x\"", 3.4)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1174:')
endif
endfunc
diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim
index b10bffd72..ba15ecfc7 100644
--- a/src/testdir/test_float_func.vim
+++ b/src/testdir/test_float_func.vim
@@ -240,8 +240,7 @@ func Test_str2float()
call assert_equal('nan', string(str2float(' nan ')))
call assert_equal(1.2, str2float(1.2))
- call CheckDefExecFailure(['str2float(1.2)'], 'E1013:')
- call CheckScriptFailure(['vim9script', 'str2float(1.2)'], 'E806:')
+ call CheckDefAndScriptFailure2(['str2float(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
call assert_fails("call str2float([])", 'E730:')
call assert_fails("call str2float({})", 'E731:')
call assert_fails("call str2float(function('string'))", 'E729:')
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e0b0314d3..6f2797c49 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -174,8 +174,7 @@ func Test_strwidth()
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:')
+ call CheckDefAndScriptFailure2(['echo strwidth(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
set ambiwidth&
@@ -242,8 +241,7 @@ func Test_str2nr()
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:')
+ call CheckDefAndScriptFailure2(['echo str2nr(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
call assert_fails('call str2nr(10, [])', 'E745:')
endfunc
@@ -505,8 +503,7 @@ func Test_simplify()
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:')
+ call CheckDefAndScriptFailure2(['echo simplify(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
endfunc
diff --git a/src/testdir/test_glob2regpat.vim b/src/testdir/test_glob2regpat.vim
index 18e22dc66..d0c5d1454 100644
--- a/src/testdir/test_glob2regpat.vim
+++ b/src/testdir/test_glob2regpat.vim
@@ -5,8 +5,7 @@ source vim9.vim
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:')
+ call CheckDefAndScriptFailure2(['echo glob2regpat(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
endif
call assert_fails('call glob2regpat("}")', 'E219:')
call assert_fails('call glob2regpat("{")', 'E220:')
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index 370b5c7f2..90f5679c9 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -438,7 +438,7 @@ func Test_dict_func_remove()
var d = {1: 'a', 3: 'c'}
call remove(d, [])
END
- call CheckScriptFailure(lines, 'E1174: String required for argument 2')
+ call CheckScriptFailure(lines, 'E1220: String or Number required for argument 2')
let lines =<< trim END
var d = {1: 'a', 3: 'c'}
call remove(d, [])
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 4ca4737ec..2001079d2 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -67,7 +67,7 @@ def Test_abs()
assert_equal(0, abs(0))
assert_equal(2, abs(-2))
assert_equal(3, abs(3))
- CheckDefFailure(['abs("text")'], 'E1013: Argument 1: type mismatch, expected number but got string', 1)
+ CheckDefAndScriptFailure2(['abs("text")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
if has('float')
assert_equal(0, abs(0))
assert_equal(2.0, abs(-2.0))
@@ -76,7 +76,7 @@ def Test_abs()
enddef
def Test_add()
- CheckDefAndScriptFailure2(['add({}, 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['add({}, 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<unknown>', 'E1226: String or List required for argument 1')
CheckDefFailure(['add([1], "a")'], 'E1012: Type mismatch; expected number but got string')
enddef
@@ -161,8 +161,8 @@ def Test_add_list()
enddef
def Test_and()
- CheckDefAndScriptFailure2(['and("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['and(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['and("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['and(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_append()
@@ -180,7 +180,7 @@ def Test_append()
assert_equal("{'a': 10}", getline(1))
append(0, function('min'))
assert_equal("function('min')", getline(1))
- CheckDefAndScriptFailure2(['append([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['append([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
bwipe!
enddef
@@ -196,27 +196,27 @@ def Test_appendbufline()
assert_equal(['0', 'one', '1', 'two', '2', ''], getbufline(bnum, 1, '$'))
appendbufline(bnum, 0, 'zero')
assert_equal(['zero'], getbufline(bnum, 1))
- CheckDefFailure(['appendbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>')
- CheckDefFailure(['appendbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>')
- CheckDefFailure(['appendbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>')
+ CheckDefAndScriptFailure2(['appendbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['appendbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 2')
+ CheckDefAndScriptFailure2(['appendbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 3')
bnum->bufwinid()->win_gotoid()
bwipe!
enddef
def Test_argc()
- CheckDefFailure(['argc("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['argc("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_arglistid()
- CheckDefFailure(['arglistid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['arglistid(1, "y")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['arglistid("x", "y")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['arglistid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['arglistid(1, "y")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['arglistid("x", "y")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_argv()
- CheckDefFailure(['argv("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['argv(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['argv("x", "y")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['argv("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['argv(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['argv("x", "y")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_assert_beeps()
@@ -224,34 +224,34 @@ def Test_assert_beeps()
enddef
def Test_assert_equalfile()
- CheckDefFailure(['assert_equalfile(1, "f2")'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefFailure(['assert_equalfile("f1", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool')
- CheckDefFailure(['assert_equalfile("f1", "f2", ["a"])'], 'E1013: Argument 3: type mismatch, expected string but got list<string>')
+ CheckDefAndScriptFailure2(['assert_equalfile(1, "f2")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['assert_equalfile("f1", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['assert_equalfile("f1", "f2", ["a"])'], 'E1013: Argument 3: type mismatch, expected string but got list<string>', 'E1174: String required for argument 3')
enddef
def Test_assert_exception()
- CheckDefFailure(['assert_exception({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
- CheckDefFailure(['assert_exception("E1:", v:null)'], 'E1013: Argument 2: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['assert_exception({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['assert_exception("E1:", v:null)'], 'E1013: Argument 2: type mismatch, expected string but got special', 'E1174: String required for argument 2')
enddef
def Test_assert_fails()
- CheckDefAndScriptFailure2(['assert_fails([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['assert_fails("a", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['assert_fails([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['assert_fails("a", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1222: String or List required for argument 2')
CheckDefAndScriptFailure2(['assert_fails("a", "b", "c", "d")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
CheckDefAndScriptFailure2(['assert_fails("a", "b", "c", 4, 5)'], 'E1013: Argument 5: type mismatch, expected string but got number', 'E1174: String required for argument 5')
enddef
def Test_assert_inrange()
- CheckDefAndScriptFailure2(['assert_inrange("a", 2, 3)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
- CheckDefAndScriptFailure2(['assert_inrange(1, "b", 3)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
- CheckDefAndScriptFailure2(['assert_inrange(1, 2, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
+ CheckDefAndScriptFailure2(['assert_inrange("a", 2, 3)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
+ CheckDefAndScriptFailure2(['assert_inrange(1, "b", 3)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2')
+ CheckDefAndScriptFailure2(['assert_inrange(1, 2, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 3')
CheckDefAndScriptFailure2(['assert_inrange(1, 2, 3, 4)'], 'E1013: Argument 4: type mismatch, expected string but got number', 'E1174: String required for argument 4')
enddef
def Test_assert_match()
- CheckDefFailure(['assert_match({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
- CheckDefFailure(['assert_match("a", 1)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefFailure(['assert_match("a", "b", null)'], 'E1013: Argument 3: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['assert_match({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', '')
+ CheckDefAndScriptFailure2(['assert_match("a", 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', '')
+ CheckDefAndScriptFailure2(['assert_match("a", "b", null)'], 'E1013: Argument 3: type mismatch, expected string but got special', '')
enddef
def Test_assert_nobeep()
@@ -259,9 +259,9 @@ def Test_assert_nobeep()
enddef
def Test_assert_notmatch()
- CheckDefFailure(['assert_notmatch({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
- CheckDefFailure(['assert_notmatch("a", 1)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefFailure(['assert_notmatch("a", "b", null)'], 'E1013: Argument 3: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['assert_notmatch({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', '')
+ CheckDefAndScriptFailure2(['assert_notmatch("a", 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', '')
+ CheckDefAndScriptFailure2(['assert_notmatch("a", "b", null)'], 'E1013: Argument 3: type mismatch, expected string but got special', '')
enddef
def Test_assert_report()
@@ -272,11 +272,11 @@ def Test_balloon_show()
CheckGui
CheckFeature balloon_eval
- assert_fails('balloon_show(10)', 'E1174:')
- assert_fails('balloon_show(true)', 'E1174:')
+ assert_fails('balloon_show(10)', 'E1222:')
+ assert_fails('balloon_show(true)', 'E1222:')
- CheckDefAndScriptFailure2(['balloon_show(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['balloon_show({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['balloon_show(1.2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1222: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['balloon_show({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1')
enddef
def Test_balloon_split()
@@ -296,32 +296,34 @@ def Test_browse()
enddef
def Test_browsedir()
- CheckDefFailure(['browsedir({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
- CheckDefFailure(['browsedir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>')
+ if has('browse')
+ CheckDefAndScriptFailure2(['browsedir({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['browsedir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
+ endif
enddef
def Test_bufadd()
- assert_fails('bufadd([])', 'E730:')
+ assert_fails('bufadd([])', 'E1174:')
enddef
def Test_bufexists()
- assert_fails('bufexists(true)', 'E1174:')
+ assert_fails('bufexists(true)', 'E1220:')
enddef
def Test_buflisted()
var res: bool = buflisted('asdf')
assert_equal(false, res)
- assert_fails('buflisted(true)', 'E1174:')
- assert_fails('buflisted([])', 'E1174:')
+ assert_fails('buflisted(true)', 'E1220:')
+ assert_fails('buflisted([])', 'E1220:')
enddef
def Test_bufload()
- assert_fails('bufload([])', 'E730:')
+ assert_fails('bufload([])', 'E1220:')
enddef
def Test_bufloaded()
- assert_fails('bufloaded(true)', 'E1174:')
- assert_fails('bufloaded([])', 'E1174:')
+ assert_fails('bufloaded(true)', 'E1220:')
+ assert_fails('bufloaded([])', 'E1220:')
enddef
def Test_bufname()
@@ -330,8 +332,8 @@ def Test_bufname()
edit OtherFile
bufname('#')->assert_equal('SomeFile')
close
- assert_fails('bufname(true)', 'E1138:')
- assert_fails('bufname([])', 'E745:')
+ assert_fails('bufname(true)', 'E1220:')
+ assert_fails('bufname([])', 'E1220:')
enddef
def Test_bufnr()
@@ -341,7 +343,7 @@ def Test_bufnr()
buf = bufnr('Xdummy', true)
buf->assert_notequal(-1)
exe 'bwipe! ' .. buf
- CheckDefAndScriptFailure2(['bufnr([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['bufnr([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number 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
@@ -358,18 +360,18 @@ def Test_bufwinid()
bwipe SomeFile
bwipe OtherFile
- assert_fails('bufwinid(true)', 'E1138:')
- assert_fails('bufwinid([])', 'E745:')
+ assert_fails('bufwinid(true)', 'E1220:')
+ assert_fails('bufwinid([])', 'E1220:')
enddef
def Test_bufwinnr()
- assert_fails('bufwinnr(true)', 'E1138:')
- assert_fails('bufwinnr([])', 'E745:')
+ assert_fails('bufwinnr(true)', 'E1220:')
+ assert_fails('bufwinnr([])', 'E1220:')
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<unknown>')
+ CheckDefAndScriptFailure2(['byte2line("1")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['byte2line([])'], 'E1013: Argument 1: type mismatch, expected number but got list<unknown>', 'E1210: Number required for argument 1')
assert_equal(-1, byte2line(0))
enddef
@@ -395,7 +397,7 @@ def Test_ch_canread()
if !has('channel')
CheckFeature channel
else
- CheckDefFailure(['ch_canread(10)'], 'E1013: Argument 1: type mismatch, expected channel but got number')
+ CheckDefAndScriptFailure2(['ch_canread(10)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
endif
enddef
@@ -403,7 +405,7 @@ def Test_ch_close()
if !has('channel')
CheckFeature channel
else
- CheckDefFailure(['ch_close("c")'], 'E1013: Argument 1: type mismatch, expected channel but got string')
+ CheckDefAndScriptFailure2(['ch_close("c")'], 'E1013: Argument 1: type mismatch, expected channel but got string', 'E1217: Channel or Job required for argument 1')
endif
enddef
@@ -411,7 +413,7 @@ 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')
+ CheckDefAndScriptFailure2(['ch_close_in(true)'], 'E1013: Argument 1: type mismatch, expected channel but got bool', 'E1217: Channel or Job required for argument 1')
endif
enddef
@@ -429,7 +431,7 @@ def Test_ch_evalraw()
CheckFeature channel
else
CheckDefAndScriptFailure2(['ch_evalraw(1, "")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: 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(), 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1221: String or Blob required for argument 2')
CheckDefAndScriptFailure2(['ch_evalraw(test_null_channel(), "", [])'], 'E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3')
endif
enddef
@@ -447,8 +449,8 @@ def Test_ch_getjob()
if !has('channel')
CheckFeature channel
else
- CheckDefAndScriptFailure2(['ch_getjob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument:')
- CheckDefAndScriptFailure2(['ch_getjob({"a": 10})'], 'E1013: Argument 1: type mismatch, expected channel but got dict<number>', 'E731: Using a Dictionary as a String')
+ CheckDefAndScriptFailure2(['ch_getjob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_getjob({"a": 10})'], 'E1013: Argument 1: type mismatch, expected channel but got dict<number>', 'E1217: Channel or Job required for argument 1')
assert_equal(0, ch_getjob(test_null_channel()))
endif
enddef
@@ -457,7 +459,7 @@ def Test_ch_info()
if !has('channel')
CheckFeature channel
else
- CheckDefFailure(['ch_info([1])'], 'E1013: Argument 1: type mismatch, expected channel but got list<number>')
+ CheckDefAndScriptFailure2(['ch_info([1])'], 'E1013: Argument 1: type mismatch, expected channel but got list<number>', 'E1217: Channel or Job required for argument 1')
endif
enddef
@@ -495,8 +497,8 @@ 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<any> but got list<unknown>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['ch_read(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_read(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
endif
enddef
@@ -504,8 +506,8 @@ 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<any> but got list<unknown>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['ch_readblob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_readblob(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
endif
enddef
@@ -513,8 +515,8 @@ 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<any> but got list<unknown>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['ch_readraw(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_readraw(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
endif
enddef
@@ -532,7 +534,7 @@ def Test_ch_sendraw()
CheckFeature channel
else
CheckDefAndScriptFailure2(['ch_sendraw(1, "")'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: 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(), 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1221: String or Blob required for argument 2')
CheckDefAndScriptFailure2(['ch_sendraw(test_null_channel(), "", [])'], 'E1013: Argument 3: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 3')
endif
enddef
@@ -541,8 +543,8 @@ 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<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['ch_setoptions(1, {})'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_setoptions(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
endif
enddef
@@ -550,8 +552,8 @@ 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<any> but got list<unknown>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['ch_status(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E1217: Channel or Job required for argument 1')
+ CheckDefAndScriptFailure2(['ch_status(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
endif
enddef
@@ -572,8 +574,8 @@ def Test_charclass()
enddef
def Test_charcol()
- CheckDefFailure(['charcol(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefFailure(['charcol({a: 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>')
+ CheckDefAndScriptFailure2(['charcol(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['charcol({a: 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1')
new
setline(1, ['abcdefgh'])
cursor(1, 4)
@@ -584,9 +586,9 @@ def Test_charcol()
enddef
def Test_charidx()
- CheckDefFailure(['charidx("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['charidx(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob')
- CheckDefFailure(['charidx("a", 1, "")'], 'E1013: Argument 3: type mismatch, expected bool but got string')
+ CheckDefAndScriptFailure2(['charidx(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['charidx("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['charidx("a", 1, "")'], 'E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3')
enddef
def Test_chdir()
@@ -594,14 +596,14 @@ def Test_chdir()
enddef
def Test_cindent()
- CheckDefFailure(['cindent([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
- CheckDefFailure(['cindent(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['cindent([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['cindent(null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1')
assert_equal(-1, cindent(0))
assert_equal(0, cindent('.'))
enddef
def Test_clearmatches()
- CheckDefFailure(['clearmatches("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['clearmatches("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_col()
@@ -612,11 +614,11 @@ def Test_col()
col([1, '$'])->assert_equal(9)
assert_equal(0, col([10, '$']))
- assert_fails('col(true)', 'E1174:')
+ assert_fails('col(true)', 'E1222:')
- CheckDefFailure(['col(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefFailure(['col({a: 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>')
- CheckDefFailure(['col(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool')
+ CheckDefAndScriptFailure2(['col(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['col({a: 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['col(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1222: String or List required for argument 1')
bw!
enddef
@@ -626,12 +628,12 @@ def Test_complete()
enddef
def Test_complete_add()
- CheckDefAndScriptFailure2(['complete_add([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['complete_add([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1223: String or List required for argument 1')
enddef
def Test_complete_info()
- CheckDefFailure(['complete_info("")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string')
- CheckDefFailure(['complete_info({})'], 'E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>')
+ CheckDefAndScriptFailure2(['complete_info("")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['complete_info({})'], 'E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>', 'E1211: List required for argument 1')
assert_equal({'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}, complete_info())
assert_equal({'mode': '', 'items': []}, complete_info(['mode', 'items']))
enddef
@@ -671,7 +673,7 @@ enddef
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(10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1225: String or List 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)
@@ -701,14 +703,14 @@ def Test_cursor()
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(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected number but got blob', 'E1224: String or List 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()
CheckMSWindows
- CheckDefFailure(['debugbreak("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['debugbreak("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_deepcopy()
@@ -719,25 +721,25 @@ def Test_delete()
var res: bool = delete('doesnotexist')
assert_equal(true, res)
- CheckDefFailure(['delete(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefFailure(['delete("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['delete(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['delete("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
def Test_deletebufline()
- CheckDefAndScriptFailure2(['deletebufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['deletebufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', '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')
+ CheckDefAndScriptFailure2(['deletebufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['deletebufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 2')
+ CheckDefAndScriptFailure2(['deletebufline("a", 2, 0z10)'], 'E1013: Argument 3: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 3')
enddef
def Test_diff_filler()
- CheckDefFailure(['diff_filler([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
- CheckDefFailure(['diff_filler(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool')
+ CheckDefAndScriptFailure2(['diff_filler([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['diff_filler(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
assert_equal(0, diff_filler(1))
assert_equal(0, diff_filler('.'))
enddef
def Test_diff_hlID()
- CheckDefAndScriptFailure2(['diff_hlID(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['diff_hlID(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['diff_hlID(1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
@@ -747,15 +749,15 @@ def Test_echoraw()
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')
+ CheckDefAndScriptFailure2(['escape(10, " ")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['escape(true, false)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['escape("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
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')
+ CheckDefAndScriptFailure2(['eval(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['eval(null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1')
assert_equal(2, eval('1 + 1'))
enddef
@@ -773,10 +775,10 @@ def Test_execute()
res = execute(["echo 'here'", "echo 'there'"])
assert_equal("\nhere\nthere", res)
- CheckDefFailure(['execute(123)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['execute(123)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1222: String or List required for argument 1')
CheckDefFailure(['execute([123])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>')
CheckDefExecFailure(['echo execute(["xx", 123])'], 'E492')
- CheckDefFailure(['execute("xx", 123)'], 'E1013: Argument 2: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['execute("xx", 123)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
def Test_exepath()
@@ -786,7 +788,7 @@ def Test_exepath()
enddef
def Test_exists()
- CheckDefFailure(['exists(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['exists(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
call assert_equal(1, exists('&tabstop'))
enddef
@@ -826,9 +828,9 @@ def Test_extend_arg_types()
END
CheckDefAndScriptSuccess(lines)
- CheckDefFailure(['extend("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string')
- CheckDefFailure(['extend([1, 2], 3)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number')
- CheckDefFailure(['extend([1, 2], ["x"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>')
+ CheckDefAndScriptFailure2(['extend("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E712: Argument of extend() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['extend([1, 2], 3)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number', 'E712: Argument of extend() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['extend([1, 2], ["x"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>')
CheckDefFailure(['extend([1, 2], [3], "x")'], 'E1013: Argument 3: type mismatch, expected number but got string')
CheckDefFailure(['extend({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<number> but got number')
@@ -924,16 +926,16 @@ def Test_extendnew()
assert_equal([1, 2, 'a'], extendnew([1, 2], ['a']))
assert_equal({one: 1, two: 'a'}, extendnew({one: 1}, {two: 'a'}))
- CheckDefFailure(['extendnew({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<number> but got number')
- CheckDefFailure(['extendnew({a: 1}, [42])'], 'E1013: Argument 2: type mismatch, expected dict<number> but got list<number>')
- CheckDefFailure(['extendnew([1, 2], "x")'], 'E1013: Argument 2: type mismatch, expected list<number> but got string')
- CheckDefFailure(['extendnew([1, 2], {x: 1})'], 'E1013: Argument 2: type mismatch, expected list<number> but got dict<number>')
+ CheckDefAndScriptFailure2(['extendnew({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<number> but got number', 'E712: Argument of extendnew() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['extendnew({a: 1}, [42])'], 'E1013: Argument 2: type mismatch, expected dict<number> but got list<number>', 'E712: Argument of extendnew() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['extendnew([1, 2], "x")'], 'E1013: Argument 2: type mismatch, expected list<number> but got string', 'E712: Argument of extendnew() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['extendnew([1, 2], {x: 1})'], 'E1013: Argument 2: type mismatch, expected list<number> but got dict<number>', 'E712: Argument of extendnew() must be a List or Dictionary')
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<unknown>')
+ CheckDefAndScriptFailure2(['feedkeys(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['feedkeys("x", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['feedkeys([], {})'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
g:TestVar = 1
feedkeys(":g:TestVar = 789\n", 'xt')
assert_equal(789, g:TestVar)
@@ -960,16 +962,16 @@ def Test_finddir()
CheckDefAndScriptFailure2(['finddir(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
CheckDefAndScriptFailure2(['finddir(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1')
CheckDefExecFailure(['echo finddir("")'], 'E1175:')
- CheckDefAndScriptFailure2(['finddir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['finddir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['finddir("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['finddir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_findfile()
CheckDefExecFailure(['findfile(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool')
CheckDefExecFailure(['findfile(v:null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
CheckDefExecFailure(['findfile("")'], 'E1175:')
- CheckDefAndScriptFailure2(['findfile("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['findfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['findfile("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['findfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_flattennew()
@@ -996,61 +998,61 @@ def Test_float_funcs_args()
CheckFeature float
# acos()
- CheckDefFailure(['acos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['acos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# asin()
- CheckDefFailure(['asin("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['asin("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# atan()
- CheckDefFailure(['atan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['atan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# atan2()
- CheckDefFailure(['atan2("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['atan2(1.2, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['atan2(1.2)'], 'E119:')
+ CheckDefAndScriptFailure2(['atan2("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
+ CheckDefAndScriptFailure2(['atan2(1.2, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2')
+ CheckDefAndScriptFailure2(['atan2(1.2)'], 'E119:', 'E119:')
# ceil()
- CheckDefFailure(['ceil("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['ceil("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# cos()
- CheckDefFailure(['cos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['cos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# cosh()
- CheckDefFailure(['cosh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['cosh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# exp()
- CheckDefFailure(['exp("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['exp("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# float2nr()
- CheckDefFailure(['float2nr("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['float2nr("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# floor()
- CheckDefFailure(['floor("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['floor("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# fmod()
- CheckDefFailure(['fmod(1.1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['fmod("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['fmod(1.1)'], 'E119:')
+ CheckDefAndScriptFailure2(['fmod(1.1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2')
+ CheckDefAndScriptFailure2(['fmod("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
+ CheckDefAndScriptFailure2(['fmod(1.1)'], 'E119:', 'E119:')
# isinf()
- CheckDefFailure(['isinf("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['isinf("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# isnan()
- CheckDefFailure(['isnan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['isnan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# log()
- CheckDefFailure(['log("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['log("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# log10()
- CheckDefFailure(['log10("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['log10("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# pow()
- CheckDefFailure(['pow("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['pow(1.1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string')
- CheckDefFailure(['pow(1.1)'], 'E119:')
+ CheckDefAndScriptFailure2(['pow("a", 1.1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
+ CheckDefAndScriptFailure2(['pow(1.1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 2')
+ CheckDefAndScriptFailure2(['pow(1.1)'], 'E119:', 'E119:')
# round()
- CheckDefFailure(['round("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['round("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# sin()
- CheckDefFailure(['sin("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['sin("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# sinh()
- CheckDefFailure(['sinh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['sinh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# sqrt()
- CheckDefFailure(['sqrt("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['sqrt("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# tan()
- CheckDefFailure(['tan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['tan("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# tanh()
- CheckDefFailure(['tanh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['tanh("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
# trunc()
- CheckDefFailure(['trunc("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['trunc("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1')
enddef
def Test_fnameescape()
- CheckDefFailure(['fnameescape(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['fnameescape(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal('\+a\%b\|', fnameescape('+a%b|'))
enddef
@@ -1070,7 +1072,7 @@ def Wrong_dict_key_type(items: list<number>): list<number>
enddef
def Test_filter()
- CheckDefAndScriptFailure2(['filter(1.1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got float', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['filter(1.1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got float', 'E1228: List or Dictionary or Blob required for argument 1')
assert_equal([], filter([1, 2, 3], '0'))
assert_equal([1, 2, 3], filter([1, 2, 3], '1'))
assert_equal({b: 20}, filter({a: 10, b: 20}, 'v:val == 20'))
@@ -1096,25 +1098,25 @@ def Test_filter_missing_argument()
enddef
def Test_foldclosed()
- CheckDefFailure(['foldclosed(function("min"))'], 'E1013: Argument 1: type mismatch, expected string but got func(...): any')
+ CheckDefAndScriptFailure2(['foldclosed(function("min"))'], 'E1013: Argument 1: type mismatch, expected string but got func(...): any', 'E1220: String or Number required for argument 1')
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')
+ CheckDefAndScriptFailure2(['foldclosedend(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
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')
+ CheckDefAndScriptFailure2(['foldlevel(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
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')
+ CheckDefAndScriptFailure2(['foldtextresult(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
assert_equal('', foldtextresult(1))
assert_equal('', foldtextresult('.'))
enddef
@@ -1154,8 +1156,8 @@ enddef
def Test_garbagecollect()
garbagecollect(true)
- CheckDefAndScriptFailure2(['garbagecollect("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
- CheckDefAndScriptFailure2(['garbagecollect(20)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
+ CheckDefAndScriptFailure2(['garbagecollect("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['garbagecollect(20)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
enddef
def Test_get()
@@ -1196,13 +1198,13 @@ def Test_getbufline()
getbufline(-1, 1, '$')->assert_equal([])
bwipe!
- CheckDefAndScriptFailure2(['getbufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['getbufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', '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')
+ CheckDefAndScriptFailure2(['getbufline([], 2)'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['getbufline("a", [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 2')
+ CheckDefAndScriptFailure2(['getbufline("a", 2, 0z10)'], 'E1013: Argument 3: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 3')
enddef
def Test_getbufvar()
- CheckDefAndScriptFailure2(['getbufvar(true, "v")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['getbufvar(true, "v")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['getbufvar(1, 2, 3)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
@@ -1219,8 +1221,8 @@ def Test_getchar()
endwhile
getchar(true)->assert_equal(0)
getchar(1)->assert_equal(0)
- CheckDefAndScriptFailure2(['getchar(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
- CheckDefAndScriptFailure2(['getchar("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
+ CheckDefAndScriptFailure2(['getchar(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['getchar("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1')
enddef
def Test_getcharpos()
@@ -1229,8 +1231,8 @@ def Test_getcharpos()
enddef
def Test_getcharstr()
- CheckDefAndScriptFailure2(['getcharstr(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
- CheckDefAndScriptFailure2(['getcharstr("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
+ CheckDefAndScriptFailure2(['getcharstr(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['getcharstr("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1')
enddef
def Test_getcompletion()
@@ -1244,17 +1246,17 @@ def Test_getcompletion()
enddef
def Test_getcurpos()
- CheckDefFailure(['getcursorcharpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getcursorcharpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_getcursorcharpos()
- CheckDefFailure(['getcursorcharpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getcursorcharpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_getcwd()
- CheckDefFailure(['getcwd("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['getcwd("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['getcwd(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getcwd("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['getcwd("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['getcwd(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_getenv()
@@ -1271,7 +1273,7 @@ def Test_getenv()
enddef
def Test_getfontname()
- CheckDefFailure(['getfontname(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['getfontname(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
enddef
def Test_getfperm()
@@ -1307,9 +1309,9 @@ def Test_getftype()
enddef
def Test_getjumplist()
- CheckDefFailure(['getjumplist("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['getjumplist("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['getjumplist(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getjumplist("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['getjumplist("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['getjumplist(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_getline()
@@ -1329,13 +1331,13 @@ def Test_getline()
echo getline('1')
END
CheckDefExecAndScriptFailure(lines, 'E1209:')
- CheckDefAndScriptFailure2(['getline(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['getline(1, true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['getline(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['getline(1, true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2')
enddef
def Test_getloclist()
- CheckDefAndScriptFailure2(['getloclist("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['getloclist(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['getloclist("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['getloclist(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
enddef
def Test_getloclist_return_type()
@@ -1347,23 +1349,23 @@ def Test_getloclist_return_type()
enddef
def Test_getmarklist()
- CheckDefFailure(['getmarklist([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['getmarklist([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
assert_equal([], getmarklist(10000))
assert_fails('getmarklist("a%b@#")', 'E94:')
enddef
def Test_getmatches()
- CheckDefFailure(['getmatches("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getmatches("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_getpos()
- CheckDefFailure(['getpos(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['getpos(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal([0, 1, 1, 0], getpos('.'))
CheckDefExecFailure(['getpos("a")'], 'E1209:')
enddef
def Test_getqflist()
- CheckDefFailure(['getqflist([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['getqflist([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1')
call assert_equal({}, getqflist({}))
enddef
@@ -1406,7 +1408,7 @@ def Test_getregtype()
enddef
def Test_gettabinfo()
- CheckDefFailure(['gettabinfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['gettabinfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_gettabvar()
@@ -1421,20 +1423,20 @@ def Test_gettabwinvar()
enddef
def Test_gettagstack()
- CheckDefFailure(['gettagstack("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['gettagstack("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_gettext()
- CheckDefFailure(['gettext(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['gettext(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal('abc', gettext("abc"))
enddef
def Test_getwininfo()
- CheckDefFailure(['getwininfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getwininfo("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_getwinpos()
- CheckDefFailure(['getwinpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['getwinpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_getwinvar()
@@ -1451,7 +1453,7 @@ def Test_glob()
enddef
def Test_glob2regpat()
- CheckDefFailure(['glob2regpat(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['glob2regpat(null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1174: String required for argument 1')
assert_equal('^$', glob2regpat(''))
enddef
@@ -1477,14 +1479,14 @@ def Test_has_key()
assert_false(has_key(d, 'x'))
assert_false(has_key(d, 99))
- CheckDefAndScriptFailure2(['has_key([1, 2], "k")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
- CheckDefAndScriptFailure2(['has_key({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['has_key([1, 2], "k")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1')
+ CheckDefAndScriptFailure2(['has_key({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 2')
enddef
def Test_haslocaldir()
- CheckDefFailure(['haslocaldir("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['haslocaldir("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['haslocaldir(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['haslocaldir("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['haslocaldir("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['haslocaldir(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_hasmapto()
@@ -1498,15 +1500,15 @@ def Test_hasmapto()
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')
+ CheckDefAndScriptFailure2(['histadd(1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['histadd(":", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
histadd("search", 'skyblue')
assert_equal('skyblue', histget('/', -1))
enddef
def Test_histdel()
CheckDefAndScriptFailure2(['histdel(1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['histdel(":", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['histdel(":", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2')
enddef
def Test_histget()
@@ -1515,36 +1517,36 @@ def Test_histget()
enddef
def Test_histnr()
- CheckDefFailure(['histnr(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['histnr(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal(-1, histnr('abc'))
enddef
def Test_hlID()
- CheckDefFailure(['hlID(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['hlID(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal(0, hlID('NonExistingHighlight'))
enddef
def Test_hlexists()
- CheckDefFailure(['hlexists([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['hlexists([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
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')
+ CheckDefAndScriptFailure2(['iconv(1, "from", "to")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['iconv("abc", 10, "to")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['iconv("abc", "from", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
assert_equal('abc', iconv('abc', 'fromenc', 'toenc'))
enddef
def Test_indent()
- CheckDefAndScriptFailure2(['indent([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
- CheckDefAndScriptFailure2(['indent(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['indent([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['indent(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
assert_equal(0, indent(1))
enddef
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<any> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['index("a", "a")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: String or List required for argument 1')
CheckDefFailure(['index(["1"], 1)'], 'E1013: Argument 2: type mismatch, expected string but got number')
CheckDefAndScriptFailure2(['index(0z10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
CheckDefAndScriptFailure2(['index([1], 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
@@ -1552,22 +1554,22 @@ def Test_index()
enddef
def Test_input()
- CheckDefFailure(['input(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['input(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefFailure(['input("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['input("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E180: Invalid complete value')
+ CheckDefAndScriptFailure2(['input(5)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['input(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['input("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['input("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
enddef
def Test_inputdialog()
- CheckDefFailure(['inputdialog(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['inputdialog(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefFailure(['inputdialog("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefFailure(['inputdialog("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['inputdialog(5)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['inputdialog(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['inputdialog("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['inputdialog("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
enddef
def Test_inputlist()
- CheckDefFailure(['inputlist(10)'], 'E1013: Argument 1: type mismatch, expected list<string> but got number')
- CheckDefFailure(['inputlist("abc")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string')
+ CheckDefAndScriptFailure2(['inputlist(10)'], 'E1013: Argument 1: type mismatch, expected list<string> but got number', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['inputlist("abc")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string', 'E1211: List required for argument 1')
CheckDefFailure(['inputlist([1, 2, 3])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>')
feedkeys("2\<CR>", 't')
var r: number = inputlist(['a', 'b', 'c'])
@@ -1575,8 +1577,8 @@ def Test_inputlist()
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')
+ CheckDefAndScriptFailure2(['inputsecret(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['inputsecret("Pass:", 20)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
feedkeys("\<CR>", 't')
var ans: string = inputsecret('Pass:', '123')
assert_equal('123', ans)
@@ -1617,17 +1619,17 @@ def Test_insert()
assert_equal(['a', 'b', 'c'], insert(['b', 'c'], 'a'))
assert_equal(0z1234, insert(0z34, 0x12))
- CheckDefFailure(['insert("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 1)
- CheckDefFailure(['insert([2, 3], "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 1)
- CheckDefFailure(['insert([2, 3], 1, "x")'], 'E1013: Argument 3: type mismatch, expected number but got string', 1)
+ CheckDefAndScriptFailure2(['insert("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: String or List required for argument 1')
+ CheckDefFailure(['insert([2, 3], "a")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['insert([2, 3], 1, "x")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_invert()
- CheckDefFailure(['invert("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['invert("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_isdirectory()
- CheckDefFailure(['isdirectory(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float')
+ CheckDefAndScriptFailure2(['isdirectory(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
assert_false(isdirectory('NonExistingDir'))
enddef
@@ -1651,7 +1653,7 @@ def Test_job_getchannel()
if !has('job')
CheckFeature job
else
- CheckDefAndScriptFailure2(['job_getchannel("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['job_getchannel("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1')
assert_fails('job_getchannel(test_null_job())', 'E916: not a valid job')
endif
enddef
@@ -1660,7 +1662,7 @@ def Test_job_info()
if !has('job')
CheckFeature job
else
- CheckDefAndScriptFailure2(['job_info("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['job_info("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1')
assert_fails('job_info(test_null_job())', 'E916: not a valid job')
endif
enddef
@@ -1691,7 +1693,7 @@ def Test_job_status()
if !has('job')
CheckFeature job
else
- CheckDefAndScriptFailure2(['job_status("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['job_status("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E1218: Job required for argument 1')
assert_equal('fail', job_status(test_null_job()))
endif
enddef
@@ -1701,7 +1703,7 @@ def Test_job_stop()
CheckFeature job
else
CheckDefAndScriptFailure2(['job_stop("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E1218: 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')
+ CheckDefAndScriptFailure2(['job_stop(test_null_job(), true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2')
endif
enddef
@@ -1711,17 +1713,17 @@ def Test_join()
enddef
def Test_js_decode()
- CheckDefFailure(['js_decode(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['js_decode(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
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')
+ CheckDefAndScriptFailure2(['json_decode(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
assert_equal(1.0, json_decode('1.0'))
enddef
def Test_keys()
- CheckDefFailure(['keys([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['keys([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1')
assert_equal(['a'], {a: 'v'}->keys())
assert_equal([], {}->keys())
enddef
@@ -1744,14 +1746,14 @@ def Test_libcall()
CheckFeature libcall
CheckDefAndScriptFailure2(['libcall(1, "b", 3)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
CheckDefAndScriptFailure2(['libcall("a", 2, 3)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
- CheckDefAndScriptFailure2(['libcall("a", "b", 1.1)'], 'E1013: Argument 3: type mismatch, expected string but got float', 'E1174: String required for argument 3')
+ CheckDefAndScriptFailure2(['libcall("a", "b", 1.1)'], 'E1013: Argument 3: type mismatch, expected string but got float', 'E1220: String or Number required for argument 3')
enddef
def Test_libcallnr()
CheckFeature libcall
CheckDefAndScriptFailure2(['libcallnr(1, "b", 3)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
CheckDefAndScriptFailure2(['libcallnr("a", 2, 3)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
- CheckDefAndScriptFailure2(['libcallnr("a", "b", 1.1)'], 'E1013: Argument 3: type mismatch, expected string but got float', 'E1174: String required for argument 3')
+ CheckDefAndScriptFailure2(['libcallnr("a", "b", 1.1)'], 'E1013: Argument 3: type mismatch, expected string but got float', 'E1220: String or Number required for argument 3')
enddef
def Test_line()
@@ -1761,13 +1763,13 @@ def Test_line()
enddef
def Test_line2byte()
- CheckDefFailure(['line2byte(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool')
+ CheckDefAndScriptFailure2(['line2byte(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
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<unknown>')
+ CheckDefAndScriptFailure2(['lispindent({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1220: String or Number required for argument 1')
assert_equal(0, lispindent(1))
enddef
@@ -1790,15 +1792,15 @@ def SID(): number
enddef
def Test_listener_add()
- CheckDefAndScriptFailure2(['listener_add("1", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['listener_add("1", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 2')
enddef
def Test_listener_flush()
- CheckDefAndScriptFailure2(['listener_flush([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['listener_flush([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
enddef
def Test_listener_remove()
- CheckDefAndScriptFailure2(['listener_remove("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['listener_remove("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_lua()
@@ -1809,8 +1811,8 @@ def Test_lua()
enddef
def Test_map()
- CheckDefAndScriptFailure2(['map("x", "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
- CheckDefAndScriptFailure2(['map(1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['map("x", "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1228: List or Dictionary or Blob required for argument 1')
+ CheckDefAndScriptFailure2(['map(1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1228: List or Dictionary or Blob required for argument 1')
enddef
def Test_map_failure()
@@ -1923,8 +1925,8 @@ def Test_mapcheck()
enddef
def Test_mapnew()
- CheckDefAndScriptFailure2(['mapnew("x", "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
- CheckDefAndScriptFailure2(['mapnew(1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['mapnew("x", "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1228: List or Dictionary or Blob required for argument 1')
+ CheckDefAndScriptFailure2(['mapnew(1, "1")'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1228: List or Dictionary or Blob required for argument 1')
enddef
def Test_mapset()
@@ -1934,7 +1936,7 @@ def Test_mapset()
enddef
def Test_match()
- CheckDefAndScriptFailure2(['match(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['match(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['match(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['match("s", "p", "q")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
CheckDefAndScriptFailure2(['match("s", "p", 1, "r")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
@@ -1965,17 +1967,17 @@ def Test_matchaddpos()
enddef
def Test_matcharg()
- CheckDefFailure(['matcharg("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['matcharg("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_matchdelete()
- CheckDefFailure(['matchdelete("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['matchdelete("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['matchdelete(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['matchdelete("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['matchdelete("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['matchdelete(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_matchend()
- CheckDefAndScriptFailure2(['matchend(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['matchend(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['matchend(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['matchend("s", "p", "q")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
CheckDefAndScriptFailure2(['matchend("s", "p", 1, "r")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
@@ -2002,7 +2004,7 @@ def Test_matchfuzzypos()
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(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['matchlist(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['matchlist("s", "p", "q")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
CheckDefAndScriptFailure2(['matchlist("s", "p", 1, "r")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
@@ -2020,7 +2022,7 @@ def Test_matchlist()
enddef
def Test_matchstr()
- CheckDefAndScriptFailure2(['matchstr(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['matchstr(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['matchstr(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['matchstr("s", "p", "q")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
CheckDefAndScriptFailure2(['matchstr("s", "p", 1, "r")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
@@ -2035,7 +2037,7 @@ def Test_matchstr()
enddef
def Test_matchstrpos()
- CheckDefAndScriptFailure2(['matchstrpos(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['matchstrpos(0z12, "p")'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['matchstrpos(["s"], [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['matchstrpos("s", "p", "q")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
CheckDefAndScriptFailure2(['matchstrpos("s", "p", 1, "r")'], 'E1013: Argument 4: type mismatch, expected number but got string', 'E1210: Number required for argument 4')
@@ -2063,13 +2065,13 @@ def Test_max()
? [1, max([2, 3])]
: [4, 5]
assert_equal([4, 5], l2)
- CheckDefAndScriptFailure2(['max(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E712: Argument of max() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['max(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1227: List or Dictionary required for argument 1')
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')
+ CheckDefAndScriptFailure2(['menu_info(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['menu_info(10, "n")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['menu_info("File", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
assert_equal({}, menu_info('aMenu'))
enddef
@@ -2085,30 +2087,30 @@ def Test_min()
? [1, min([2, 3])]
: [4, 5]
assert_equal([4, 5], l2)
- CheckDefAndScriptFailure2(['min(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E712: Argument of min() must be a List or Dictionary')
+ CheckDefAndScriptFailure2(['min(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1227: List or Dictionary required for argument 1')
enddef
def Test_mkdir()
- CheckDefAndScriptFailure2(['mkdir(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['mkdir("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['mkdir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['mkdir(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['mkdir("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['mkdir("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
delete('a', 'rf')
enddef
def Test_mode()
- CheckDefFailure(['mode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string')
- CheckDefFailure(['mode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number')
+ CheckDefAndScriptFailure2(['mode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['mode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
enddef
def Test_mzeval()
if !has('mzscheme')
CheckFeature mzscheme
endif
- CheckDefAndScriptFailure2(['mzeval(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['mzeval(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
enddef
def Test_nextnonblank()
- CheckDefFailure(['nextnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['nextnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1')
assert_equal(0, nextnonblank(1))
enddef
@@ -2119,8 +2121,8 @@ def Test_nr2char()
enddef
def Test_or()
- CheckDefFailure(['or("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['or(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['or("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['or(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_pathshorten()
@@ -2132,12 +2134,12 @@ def Test_perleval()
if !has('perl')
CheckFeature perl
endif
- CheckDefAndScriptFailure2(['perleval(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['perleval(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
enddef
def Test_popup_atcursor()
- CheckDefAndScriptFailure2(['popup_atcursor({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
- CheckDefAndScriptFailure2(['popup_atcursor("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['popup_atcursor({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['popup_atcursor("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
# Pass variable of type 'any' to popup_atcursor()
var what: any = 'Hello'
@@ -2147,13 +2149,13 @@ def Test_popup_atcursor()
enddef
def Test_popup_beval()
- CheckDefAndScriptFailure2(['popup_beval({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
- CheckDefAndScriptFailure2(['popup_beval("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['popup_beval({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['popup_beval("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
enddef
def Test_popup_clear()
- CheckDefAndScriptFailure2(['popup_clear(["a"])'], 'E1013: Argument 1: type mismatch, expected bool but got list<string>', 'E745: Using a List as a Number')
- CheckDefAndScriptFailure2(['popup_clear(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
+ CheckDefAndScriptFailure2(['popup_clear(["a"])'], 'E1013: Argument 1: type mismatch, expected bool but got list<string>', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['popup_clear(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
enddef
def Test_popup_close()
@@ -2169,8 +2171,8 @@ def Test_popup_create()
enddef
def Test_popup_dialog()
- CheckDefAndScriptFailure2(['popup_dialog({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
- CheckDefAndScriptFailure2(['popup_dialog("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['popup_dialog({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['popup_dialog("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
enddef
def Test_popup_filter_menu()
@@ -2184,28 +2186,28 @@ def Test_popup_filter_yesno()
enddef
def Test_popup_getoptions()
- CheckDefAndScriptFailure2(['popup_getoptions("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['popup_getoptions(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['popup_getoptions("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_getoptions(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1')
enddef
def Test_popup_getpos()
- CheckDefAndScriptFailure2(['popup_getpos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['popup_getpos(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['popup_getpos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_getpos(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1')
enddef
def Test_popup_hide()
- CheckDefAndScriptFailure2(['popup_hide("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['popup_hide(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['popup_hide("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_hide(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1')
enddef
def Test_popup_locate()
- CheckDefAndScriptFailure2(['popup_locate("a", 20)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['popup_locate(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['popup_locate("a", 20)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_locate(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_popup_menu()
- CheckDefAndScriptFailure2(['popup_menu({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
- CheckDefAndScriptFailure2(['popup_menu("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['popup_menu({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['popup_menu("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
enddef
def Test_popup_move()
@@ -2214,8 +2216,8 @@ def Test_popup_move()
enddef
def Test_popup_notification()
- CheckDefAndScriptFailure2(['popup_notification({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
- CheckDefAndScriptFailure2(['popup_notification("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['popup_notification({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['popup_notification("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
enddef
def Test_popup_setoptions()
@@ -2225,21 +2227,21 @@ enddef
def Test_popup_settext()
CheckDefAndScriptFailure2(['popup_settext("x", [])'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
- CheckDefAndScriptFailure2(['popup_settext(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['popup_settext(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1222: String or List required for argument 2')
enddef
def Test_popup_show()
- CheckDefAndScriptFailure2(['popup_show("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['popup_show(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['popup_show("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_show(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1')
enddef
def Test_prevnonblank()
- CheckDefFailure(['prevnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
+ CheckDefAndScriptFailure2(['prevnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special', 'E1220: String or Number required for argument 1')
assert_equal(0, prevnonblank(1))
enddef
def Test_printf()
- CheckDefAndScriptFailure2(['printf([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['printf([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
printf(0x10)->assert_equal('16')
assert_equal(" abc", "abc"->printf("%4s"))
enddef
@@ -2248,7 +2250,7 @@ def Test_prompt_getprompt()
if !has('channel')
CheckFeature channel
else
- CheckDefFailure(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
assert_equal('', prompt_getprompt('NonExistingBuf'))
endif
enddef
@@ -2257,7 +2259,7 @@ def Test_prompt_setcallback()
if !has('channel')
CheckFeature channel
else
- CheckDefAndScriptFailure2(['prompt_setcallback(true, "1")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prompt_setcallback(true, "1")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
endif
enddef
@@ -2265,7 +2267,7 @@ def Test_prompt_setinterrupt()
if !has('channel')
CheckFeature channel
else
- CheckDefAndScriptFailure2(['prompt_setinterrupt(true, "1")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prompt_setinterrupt(true, "1")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
endif
enddef
@@ -2273,7 +2275,7 @@ def Test_prompt_setprompt()
if !has('channel')
CheckFeature channel
else
- CheckDefAndScriptFailure2(['prompt_setprompt([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prompt_setprompt([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['prompt_setprompt(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
endif
enddef
@@ -2291,9 +2293,9 @@ def Test_prop_clear()
enddef
def Test_prop_find()
- CheckDefAndScriptFailure2(['prop_find([1, 2])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
- CheckDefAndScriptFailure2(['prop_find([1, 2], "k")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
- CheckDefAndScriptFailure2(['prop_find({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['prop_find([1, 2])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1')
+ CheckDefAndScriptFailure2(['prop_find([1, 2], "k")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1')
+ CheckDefAndScriptFailure2(['prop_find({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1174: String required for argument 2')
enddef
def Test_prop_list()
@@ -2308,64 +2310,64 @@ def Test_prop_remove()
enddef
def Test_prop_type_add()
- CheckDefAndScriptFailure2(['prop_type_add({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_add("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_add({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_add("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2')
enddef
def Test_prop_type_change()
- CheckDefAndScriptFailure2(['prop_type_change({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_change("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_change({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_change("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2')
enddef
def Test_prop_type_delete()
- CheckDefAndScriptFailure2(['prop_type_delete({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_delete({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_delete("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_delete({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_delete({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_delete("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2')
enddef
def Test_prop_type_get()
- CheckDefAndScriptFailure2(['prop_type_get({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_get({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['prop_type_get("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_get({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_get({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_get("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2')
enddef
def Test_prop_type_list()
- CheckDefAndScriptFailure2(['prop_type_list(["a"])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<string>', 'E715: Dictionary required')
- CheckDefAndScriptFailure2(['prop_type_list(2)'], 'E1013: Argument 1: type mismatch, expected dict<any> but got number', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_list(["a"])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 1')
+ CheckDefAndScriptFailure2(['prop_type_list(2)'], 'E1013: Argument 1: type mismatch, expected dict<any> but got number', 'E1206: Dictionary required for argument 1')
enddef
def Test_py3eval()
if !has('python3')
CheckFeature python3
endif
- CheckDefAndScriptFailure2(['py3eval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['py3eval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
enddef
def Test_pyeval()
if !has('python')
CheckFeature python
endif
- CheckDefAndScriptFailure2(['pyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['pyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
enddef
def Test_pyxeval()
if !has('python') && !has('python3')
CheckFeature python
endif
- CheckDefAndScriptFailure2(['pyxeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['pyxeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
enddef
def Test_rand()
- CheckDefFailure(['rand(10)'], 'E1013: Argument 1: type mismatch, expected list<number> but got number')
+ CheckDefAndScriptFailure2(['rand(10)'], 'E1013: Argument 1: type mismatch, expected list<number> but got number', 'E1211: List required for argument 1')
CheckDefFailure(['rand(["a"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>')
assert_true(rand() >= 0)
assert_true(rand(srand()) >= 0)
enddef
def Test_range()
- CheckDefAndScriptFailure2(['range("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['range(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['range(10, 20, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['range("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['range(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['range(10, 20, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_readdir()
@@ -2405,8 +2407,8 @@ def Test_readfile()
CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got list<string>', 1)
delete('Xreadfile')
- CheckDefAndScriptFailure2(['readfile("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob', 'E976: Using a Blob as a String')
- CheckDefAndScriptFailure2(['readfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['readfile("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['readfile("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_reduce()
@@ -2421,9 +2423,9 @@ def Test_reltime()
CheckDefExecAndScriptFailure(['[]->reltime()'], 'E474:')
CheckDefExecAndScriptFailure(['[]->reltime([])'], 'E474:')
- CheckDefFailure(['reltime("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string')
+ CheckDefAndScriptFailure2(['reltime("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string', 'E1211: List required for argument 1')
CheckDefFailure(['reltime(["x", "y"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>')
- CheckDefFailure(['reltime([1, 2], 10)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number')
+ CheckDefAndScriptFailure2(['reltime([1, 2], 10)'], 'E1013: Argument 2: type mismatch, expected list<number> but got number', 'E1211: List required for argument 2')
CheckDefFailure(['reltime([1, 2], ["a", "b"])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>')
var start: list<any> = reltime()
assert_true(type(reltime(start)) == v:t_list)
@@ -2436,7 +2438,7 @@ def Test_reltimefloat()
CheckDefExecAndScriptFailure(['[]->reltimefloat()'], 'E474:')
- CheckDefFailure(['reltimefloat("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string')
+ CheckDefAndScriptFailure2(['reltimefloat("x")'], 'E1013: Argument 1: type mismatch, expected list<number> but got string', 'E1211: List required for argument 1')
CheckDefFailure(['reltimefloat([1.1])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<float>')
assert_true(type(reltimefloat(reltime())) == v:t_float)
enddef
@@ -2446,7 +2448,7 @@ def Test_reltimestr()
CheckDefExecAndScriptFailure(['[]->reltimestr()'], 'E474:')
- CheckDefFailure(['reltimestr(true)'], 'E1013: Argument 1: type mismatch, expected list<number> but got bool')
+ CheckDefAndScriptFailure2(['reltimestr(true)'], 'E1013: Argument 1: type mismatch, expected list<number> but got bool', 'E1211: List required for argument 1')
CheckDefFailure(['reltimestr([true])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<bool>')
assert_true(type(reltimestr(reltime())) == v:t_string)
enddef
@@ -2466,15 +2468,15 @@ def Test_remote_foreground()
CheckNotMSWindows
CheckEnv DISPLAY
- CheckDefFailure(['remote_foreground(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['remote_foreground(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_fails('remote_foreground("NonExistingServer")', 'E241:')
enddef
def Test_remote_peek()
CheckFeature clientserver
CheckEnv DISPLAY
- CheckDefAndScriptFailure2(['remote_peek(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E976: Using a Blob as a String')
- CheckDefAndScriptFailure2(['remote_peek("a5b6c7", [1])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E573: Invalid server id used')
+ CheckDefAndScriptFailure2(['remote_peek(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['remote_peek("a5b6c7", [1])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
enddef
def Test_remote_read()
@@ -2495,7 +2497,7 @@ enddef
def Test_remote_startserver()
CheckFeature clientserver
CheckEnv DISPLAY
- CheckDefFailure(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
+ CheckDefAndScriptFailure2(['remote_startserver({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
enddef
def Test_remove_const_list()
@@ -2505,10 +2507,10 @@ def Test_remove_const_list()
enddef
def Test_remove()
- CheckDefAndScriptFailure2(['remove("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['remove("a", 1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1228: List or Dictionary or Blob required for argument 1')
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({}, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number 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]
@@ -2539,26 +2541,26 @@ def Test_remove_return_type()
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')
+ CheckDefAndScriptFailure2(['rename(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['rename("a", 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
def Test_repeat()
- CheckDefAndScriptFailure2(['repeat(1.1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['repeat({a: 10}, 2)'], 'E1013: Argument 1: type mismatch, expected string but got dict<', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['repeat(1.1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1224: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['repeat({a: 10}, 2)'], 'E1013: Argument 1: type mismatch, expected string but got dict<', 'E1224: String or List required for argument 1')
assert_equal('aaa', repeat('a', 3))
assert_equal('111', repeat(1, 3))
assert_equal([1, 1, 1], repeat([1], 3))
enddef
def Test_resolve()
- CheckDefFailure(['resolve([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['resolve([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
assert_equal('SomeFile', resolve('SomeFile'))
enddef
def Test_reverse()
- CheckDefAndScriptFailure2(['reverse(10)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1')
- CheckDefAndScriptFailure2(['reverse("abc")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['reverse(10)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1226: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['reverse("abc")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1226: String or List required for argument 1')
enddef
def Test_reverse_return_type()
@@ -2574,34 +2576,34 @@ def Test_rubyeval()
if !has('ruby')
CheckFeature ruby
endif
- CheckDefAndScriptFailure2(['rubyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['rubyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
enddef
def Test_screenattr()
- CheckDefFailure(['screenattr("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['screenattr(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['screenattr("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['screenattr(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_screenchar()
- CheckDefFailure(['screenchar("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['screenchar(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['screenchar("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['screenchar(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_screenchars()
- CheckDefFailure(['screenchars("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['screenchars(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['screenchars("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['screenchars(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
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')
+ CheckDefAndScriptFailure2(['screenpos("a", 1, 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['screenpos(1, "b", 1)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['screenpos(1, 1, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
assert_equal({col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(1, 1, 1))
enddef
def Test_screenstring()
- CheckDefFailure(['screenstring("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
- CheckDefFailure(['screenstring(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['screenstring("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['screenstring(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_search()
@@ -2651,7 +2653,7 @@ def Test_searchcount()
maxcount: 99,
incomplete: 0})
bwipe!
- CheckDefAndScriptFailure2(['searchcount([1])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['searchcount([1])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 1')
enddef
def Test_searchdecl()
@@ -2720,8 +2722,8 @@ enddef
def Test_server2client()
CheckFeature clientserver
CheckEnv DISPLAY
- CheckDefAndScriptFailure2(['server2client(10, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E573: Invalid server id used:')
- CheckDefAndScriptFailure2(['server2client("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E573: Invalid server id used:')
+ CheckDefAndScriptFailure2(['server2client(10, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['server2client("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
def Test_shellescape()
@@ -2803,7 +2805,7 @@ def Test_setbufvar()
setbufvar('%', 'myvar', 123)
getbufvar('%', 'myvar')->assert_equal(123)
- CheckDefAndScriptFailure2(['setbufvar(true, "v", 3)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['setbufvar(true, "v", 3)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['setbufvar(1, 2, 3)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
enddef
@@ -2816,16 +2818,16 @@ def Test_setbufline()
setbufline(bnum, 5, 10)
setbufline(bnum, 6, ['two', 11])
assert_equal(['1', '2', '3', 'one', '10', 'two', '11'], getbufline(bnum, 1, '$'))
- CheckDefFailure(['setbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>')
- CheckDefFailure(['setbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>')
- CheckDefFailure(['setbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>')
+ CheckDefAndScriptFailure2(['setbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['setbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 2')
+ CheckDefAndScriptFailure2(['setbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>', 'E1224: String or List required for argument 3')
bnum->bufwinid()->win_gotoid()
bw!
enddef
def Test_setcellwidths()
- CheckDefAndScriptFailure2(['setcellwidths(1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E714: List required')
- CheckDefAndScriptFailure2(['setcellwidths({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+ CheckDefAndScriptFailure2(['setcellwidths(1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['setcellwidths({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1')
enddef
def Test_setcharpos()
@@ -2835,19 +2837,19 @@ def Test_setcharpos()
enddef
def Test_setcharsearch()
- CheckDefFailure(['setcharsearch("x")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got string')
- CheckDefFailure(['setcharsearch([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['setcharsearch("x")'], 'E1013: Argument 1: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 1')
+ CheckDefAndScriptFailure2(['setcharsearch([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1')
var d: dict<any> = {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')
+ CheckDefAndScriptFailure2(['setcmdpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
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(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected number but got blob', 'E1224: String or List 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
@@ -2857,8 +2859,8 @@ def Test_setenv()
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')
+ CheckDefAndScriptFailure2(['setfperm(1, "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['setfperm("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob', 'E1174: String required for argument 2')
enddef
def Test_setline()
@@ -2871,7 +2873,7 @@ def Test_setline()
assert_equal(['one', 'b', 'c', 'd'], getline(1, '$'))
setline(1, 10)
assert_equal(['10', 'b', 'c', 'd'], getline(1, '$'))
- CheckDefAndScriptFailure2(['setline([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['setline([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
bw!
enddef
@@ -2936,18 +2938,18 @@ def Test_setwinvar()
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')
+ CheckDefAndScriptFailure2(['sha256(100)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sha256(0zABCD)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
assert_equal('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', sha256('abc'))
enddef
def Test_shiftwidth()
- CheckDefFailure(['shiftwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['shiftwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_sign_define()
- CheckDefAndScriptFailure2(['sign_define({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['sign_define({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sign_define({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1')
+ CheckDefAndScriptFailure2(['sign_define({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['sign_define("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2')
enddef
@@ -2957,7 +2959,7 @@ def Test_sign_getdefined()
enddef
def Test_sign_getplaced()
- CheckDefAndScriptFailure2(['sign_getplaced(["x"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sign_getplaced(["x"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['sign_getplaced(1, ["a"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2')
CheckDefAndScriptFailure2(['sign_getplaced("a", 1.1)'], 'E1013: Argument 2: type mismatch, expected dict<any> but got float', 'E1206: Dictionary required for argument 2')
enddef
@@ -2965,40 +2967,40 @@ enddef
def Test_sign_jump()
CheckDefAndScriptFailure2(['sign_jump("a", "b", "c")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
CheckDefAndScriptFailure2(['sign_jump(1, 2, 3)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
- CheckDefAndScriptFailure2(['sign_jump(1, "b", true)'], 'E1013: Argument 3: type mismatch, expected string but got bool', 'E1174: String required for argument 3')
+ CheckDefAndScriptFailure2(['sign_jump(1, "b", true)'], 'E1013: Argument 3: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 3')
enddef
def Test_sign_place()
CheckDefAndScriptFailure2(['sign_place("a", "b", "c", "d")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
CheckDefAndScriptFailure2(['sign_place(1, 2, "c", "d")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['sign_place(1, "b", 3, "d")'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
- CheckDefAndScriptFailure2(['sign_place(1, "b", "c", 1.1)'], 'E1013: Argument 4: type mismatch, expected string but got float', 'E1174: String required for argument 4')
+ CheckDefAndScriptFailure2(['sign_place(1, "b", "c", 1.1)'], 'E1013: Argument 4: type mismatch, expected string but got float', 'E1220: String or Number required for argument 4')
CheckDefAndScriptFailure2(['sign_place(1, "b", "c", "d", [1])'], 'E1013: Argument 5: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 5')
enddef
def Test_sign_placelist()
- CheckDefAndScriptFailure2(['sign_placelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E714: List required')
- CheckDefAndScriptFailure2(['sign_placelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+ CheckDefAndScriptFailure2(['sign_placelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['sign_placelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1')
enddef
def Test_sign_undefine()
- CheckDefAndScriptFailure2(['sign_undefine({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
+ CheckDefAndScriptFailure2(['sign_undefine({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['sign_undefine([1])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>', 'E155: Unknown sign:')
enddef
def Test_sign_unplace()
- CheckDefAndScriptFailure2(['sign_unplace({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E474: Invalid argument')
- CheckDefAndScriptFailure2(['sign_unplace({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E474: Invalid argument')
- CheckDefAndScriptFailure2(['sign_unplace("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['sign_unplace({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sign_unplace({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sign_unplace("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E1206: Dictionary required for argument 2')
enddef
def Test_sign_unplacelist()
- CheckDefAndScriptFailure2(['sign_unplacelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E714: List required')
- CheckDefAndScriptFailure2(['sign_unplacelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+ CheckDefAndScriptFailure2(['sign_unplacelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1')
+ CheckDefAndScriptFailure2(['sign_unplacelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E1211: List required for argument 1')
enddef
def Test_simplify()
- CheckDefFailure(['simplify(100)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['simplify(100)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
call assert_equal('NonExistingFile', simplify('NonExistingFile'))
enddef
@@ -3051,11 +3053,11 @@ enddef
def Test_sound_stop()
CheckFeature sound
- CheckDefFailure(['sound_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['sound_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_soundfold()
- CheckDefFailure(['soundfold(20)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['soundfold(20)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal('abc', soundfold('abc'))
enddef
@@ -3082,7 +3084,7 @@ def Test_sort_argument()
enddef
def Test_spellbadword()
- CheckDefFailure(['spellbadword(100)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['spellbadword(100)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
spellbadword('good')->assert_equal(['', ''])
enddef
@@ -3094,12 +3096,12 @@ def Test_split()
enddef
def Test_srand()
- CheckDefFailure(['srand("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['srand("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
type(srand(100))->assert_equal(v:t_list)
enddef
def Test_state()
- CheckDefFailure(['state({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
+ CheckDefAndScriptFailure2(['state({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
assert_equal('', state('a'))
enddef
@@ -3110,8 +3112,7 @@ def Run_str2float()
str2float("1.00")->assert_equal(1.00)
str2float("2e-2")->assert_equal(0.02)
- CheckDefFailure(['str2float(123)'], 'E1013:')
- CheckScriptFailure(['vim9script', 'echo str2float(123)'], 'E1024:')
+ CheckDefAndScriptFailure2(['str2float(123)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
endif
enddef
@@ -3126,16 +3127,13 @@ enddef
def Test_str2nr()
str2nr("1'000'000", 10, true)->assert_equal(1000000)
- CheckDefFailure(['str2nr(123)'], 'E1013:')
- CheckScriptFailure(['vim9script', 'echo str2nr(123)'], 'E1024:')
- CheckDefFailure(['str2nr("123", "x")'], 'E1013:')
- CheckScriptFailure(['vim9script', 'echo str2nr("123", "x")'], 'E1030:')
- CheckDefFailure(['str2nr("123", 10, "x")'], 'E1013:')
- CheckScriptFailure(['vim9script', 'echo str2nr("123", 10, "x")'], 'E1135:')
+ CheckDefAndScriptFailure2(['str2nr(123)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['str2nr("123", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['str2nr("123", 10, "x")'], 'E1013: Argument 3: type mismatch, expected bool but got string', 'E1212: Bool required for argument 3')
enddef
def Test_strcharlen()
- CheckDefAndScriptFailure2(['strcharlen([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['strcharlen([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number required for argument 1')
"abc"->strcharlen()->assert_equal(3)
strcharlen(99)->assert_equal(2)
enddef
@@ -3172,13 +3170,13 @@ def Test_strgetchar()
enddef
def Test_stridx()
- CheckDefAndScriptFailure2(['stridx([1], "b")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['stridx("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['stridx("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['stridx([1], "b")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['stridx("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['stridx("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_strlen()
- CheckDefFailure(['strlen([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['strlen([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
"abc"->strlen()->assert_equal(3)
strlen(99)->assert_equal(2)
enddef
@@ -3192,8 +3190,8 @@ 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')
+ CheckDefAndScriptFailure2(['strptime(10, "2021")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['strptime("%Y", 2021)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
# BUG: Directly calling strptime() in this function gives an "E117: Unknown
# function" error on MS-Windows even with the above CheckFunction call for
# strptime().
@@ -3201,19 +3199,18 @@ def Test_strptime()
enddef
def Test_strridx()
- CheckDefAndScriptFailure2(['strridx([1], "b")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['strridx("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
- CheckDefAndScriptFailure2(['strridx("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['strridx([1], "b")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['strridx("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['strridx("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_strtrans()
- CheckDefFailure(['strtrans(20)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['strtrans(20)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
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:')
+ CheckDefAndScriptFailure2(['strwidth(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal(4, strwidth('abcd'))
enddef
@@ -3241,12 +3238,12 @@ def Test_substitute()
enddef
def Test_swapinfo()
- CheckDefFailure(['swapinfo({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
+ CheckDefAndScriptFailure2(['swapinfo({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
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<unknown>')
+ CheckDefAndScriptFailure2(['swapname([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
assert_fails('swapname("NonExistingBuf")', 'E94:')
enddef
@@ -3255,7 +3252,7 @@ def Test_synID()
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(0z10, 1, true)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number 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
@@ -3267,37 +3264,37 @@ def Test_synIDattr()
enddef
def Test_synIDtrans()
- CheckDefFailure(['synIDtrans("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['synIDtrans("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_synconcealed()
- CheckDefAndScriptFailure2(['synconcealed(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['synconcealed(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['synconcealed(1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_synstack()
- CheckDefAndScriptFailure2(['synstack(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['synstack(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['synstack(1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_system()
CheckDefAndScriptFailure2(['system(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['system("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['system("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
enddef
def Test_systemlist()
CheckDefAndScriptFailure2(['systemlist(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['systemlist("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['systemlist("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
enddef
def Test_tabpagebuflist()
- CheckDefFailure(['tabpagebuflist("t")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['tabpagebuflist("t")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
assert_equal([bufnr('')], tabpagebuflist())
assert_equal([bufnr('')], tabpagebuflist(1))
enddef
def Test_tabpagenr()
- CheckDefAndScriptFailure2(['tabpagenr(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E15: Invalid expression:')
+ CheckDefAndScriptFailure2(['tabpagenr(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal(1, tabpagenr('$'))
assert_equal(1, tabpagenr())
enddef
@@ -3308,8 +3305,8 @@ def Test_tabpagewinnr()
enddef
def Test_taglist()
- CheckDefAndScriptFailure2(['taglist([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['taglist("a", [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['taglist([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['taglist("a", [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E1174: String required for argument 2')
enddef
def Test_term_dumpload()
@@ -3328,20 +3325,20 @@ enddef
def Test_term_dumpwrite()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_dumpwrite(true, "b")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_dumpwrite(true, "b")'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_dumpwrite(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
CheckDefAndScriptFailure2(['term_dumpwrite("a", "b", [1])'], 'E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3')
enddef
def Test_term_getaltscreen()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getaltscreen(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1138: Using a Bool as a Number')
+ CheckDefAndScriptFailure2(['term_getaltscreen(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getansicolors()
CheckRunVimInTerminal
CheckFeature termguicolors
- CheckDefAndScriptFailure2(['term_getansicolors(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['term_getansicolors(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getattr()
@@ -3352,38 +3349,38 @@ enddef
def Test_term_getcursor()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getcursor({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E728: Using a Dictionary as a Number')
+ CheckDefAndScriptFailure2(['term_getcursor({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getjob()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getjob(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E974: Using a Blob as a Number')
+ CheckDefAndScriptFailure2(['term_getjob(0z10)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getline()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getline(1.1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['term_getline(1, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['term_getline(1.1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['term_getline(1, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number required for argument 2')
enddef
def Test_term_getscrolled()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getscrolled(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E805: Using a Float as a Number')
+ CheckDefAndScriptFailure2(['term_getscrolled(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getsize()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getsize(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E805: Using a Float as a Number')
+ CheckDefAndScriptFailure2(['term_getsize(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
enddef
def Test_term_getstatus()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_getstatus(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E805: Using a Float as a Number')
+ CheckDefAndScriptFailure2(['term_getstatus(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
enddef
def Test_term_gettitle()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_gettitle(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E805: Using a Float as a Number')
+ CheckDefAndScriptFailure2(['term_gettitle(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
enddef
def Test_term_gettty()
@@ -3394,19 +3391,19 @@ def Test_term_gettty()
term_gettty(buf, true)->assert_notequal('')
StopShellInTerminal(buf)
endif
- CheckDefAndScriptFailure2(['term_gettty([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_gettty([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1220: String or Number 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_scrape()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_scrape(1.1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
- CheckDefAndScriptFailure2(['term_scrape(1, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['term_scrape(1.1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
+ CheckDefAndScriptFailure2(['term_scrape(1, 1.1)'], 'E1013: Argument 2: type mismatch, expected string but got float', 'E1220: String or Number required for argument 2')
enddef
def Test_term_sendkeys()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_sendkeys([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_sendkeys([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_sendkeys(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
enddef
@@ -3414,7 +3411,7 @@ def Test_term_setansicolors()
CheckRunVimInTerminal
if has('termguicolors') || has('gui')
- CheckDefAndScriptFailure2(['term_setansicolors([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_setansicolors([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_setansicolors(10, {})'], 'E1013: Argument 2: type mismatch, expected list<any> but got dict<unknown>', 'E1211: List required for argument 2')
else
throw 'Skipped: Only works with termguicolors or gui feature'
@@ -3423,25 +3420,25 @@ enddef
def Test_term_setapi()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_setapi([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_setapi([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_setapi(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
enddef
def Test_term_setkill()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_setkill([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_setkill([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_setkill(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
enddef
def Test_term_setrestore()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_setrestore([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_setrestore([], "p")'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_setrestore(1, [])'], 'E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2')
enddef
def Test_term_setsize()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_setsize(1.1, 2, 3)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_setsize(1.1, 2, 3)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_setsize(1, "2", 3)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
CheckDefAndScriptFailure2(['term_setsize(1, 2, "3")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
@@ -3456,30 +3453,30 @@ def Test_term_start()
winnr()->assert_equal(winnr)
bwipe!
endif
- CheckDefAndScriptFailure2(['term_start({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_start({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E1222: String or List required for argument 1')
CheckDefAndScriptFailure2(['term_start([], [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
CheckDefAndScriptFailure2(['term_start("", "")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 2')
enddef
def Test_term_wait()
CheckRunVimInTerminal
- CheckDefAndScriptFailure2(['term_wait(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['term_wait(0z10, 1)'], 'E1013: Argument 1: type mismatch, expected string but got blob', 'E1220: String or Number required for argument 1')
CheckDefAndScriptFailure2(['term_wait(1, "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_test_alloc_fail()
- CheckDefAndScriptFailure2(['test_alloc_fail("a", 10, 20)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E474: Invalid argument')
- CheckDefAndScriptFailure2(['test_alloc_fail(10, "b", 20)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E474: Invalid argument')
- CheckDefAndScriptFailure2(['test_alloc_fail(10, 20, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E474: Invalid argument')
+ CheckDefAndScriptFailure2(['test_alloc_fail("a", 10, 20)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['test_alloc_fail(10, "b", 20)'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+ CheckDefAndScriptFailure2(['test_alloc_fail(10, 20, "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_test_feedinput()
- CheckDefAndScriptFailure2(['test_feedinput(test_void())'], 'E1013: Argument 1: type mismatch, expected string but got void', 'E1031: Cannot use void value')
- CheckDefAndScriptFailure2(['test_feedinput(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefAndScriptFailure2(['test_feedinput(test_void())'], 'E1013: Argument 1: type mismatch, expected string but got void', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['test_feedinput(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
enddef
def Test_test_getvalue()
- CheckDefAndScriptFailure2(['test_getvalue(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E474: Invalid argument')
+ CheckDefAndScriptFailure2(['test_getvalue(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
enddef
def Test_test_gui_drop_files()
@@ -3500,12 +3497,12 @@ def Test_test_gui_mouse_event()
enddef
def Test_test_ignore_error()
- CheckDefAndScriptFailure2(['test_ignore_error([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E474: Invalid argument')
+ CheckDefAndScriptFailure2(['test_ignore_error([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
test_ignore_error('RESET')
enddef
def Test_test_option_not_set()
- CheckDefAndScriptFailure2(['test_option_not_set([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E474: Invalid argument')
+ CheckDefAndScriptFailure2(['test_option_not_set([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
enddef
def Test_test_override()
@@ -3521,21 +3518,21 @@ def Test_test_scrollbar()
enddef
def Test_test_setmouse()
- CheckDefAndScriptFailure2(['test_setmouse("a", 10)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E474: Invalid argument')
- CheckDefAndScriptFailure2(['test_setmouse(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E474: Invalid argument')
+ CheckDefAndScriptFailure2(['test_setmouse("a", 10)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['test_setmouse(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_test_settime()
- CheckDefAndScriptFailure2(['test_settime([1])'], 'E1013: Argument 1: type mismatch, expected number but got list<number>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['test_settime([1])'], 'E1013: Argument 1: type mismatch, expected number but got list<number>', 'E1210: Number required for argument 1')
enddef
def Test_test_srand_seed()
- CheckDefAndScriptFailure2(['test_srand_seed([1])'], 'E1013: Argument 1: type mismatch, expected number but got list<number>', 'E745: Using a List as a Number')
- CheckDefAndScriptFailure2(['test_srand_seed("10")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['test_srand_seed([1])'], 'E1013: Argument 1: type mismatch, expected number but got list<number>', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['test_srand_seed("10")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_timer_info()
- CheckDefFailure(['timer_info("id")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['timer_info("id")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
assert_equal([], timer_info(100))
assert_equal([], timer_info())
enddef
@@ -3559,28 +3556,28 @@ def Test_timer_start()
enddef
def Test_timer_stop()
- CheckDefFailure(['timer_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['timer_stop("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
assert_equal(0, timer_stop(100))
enddef
def Test_tolower()
- CheckDefFailure(['tolower(1)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['tolower(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
enddef
def Test_toupper()
- CheckDefFailure(['toupper(1)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['toupper(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
enddef
def Test_tr()
- CheckDefFailure(['tr(1, "a", "b")'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefFailure(['tr("a", 1, "b")'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefFailure(['tr("a", "a", 1)'], 'E1013: Argument 3: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['tr(1, "a", "b")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['tr("a", 1, "b")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['tr("a", "a", 1)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
enddef
def Test_trim()
- CheckDefAndScriptFailure2(['trim(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['trim("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefAndScriptFailure2(['trim("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['trim(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['trim("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E1174: String required for argument 2')
+ CheckDefAndScriptFailure2(['trim("a", "b", "c")'], 'E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3')
enddef
def Test_typename()
@@ -3590,7 +3587,7 @@ def Test_typename()
enddef
def Test_undofile()
- CheckDefFailure(['undofile(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['undofile(10)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
assert_equal('.abc.un~', fnamemodify(undofile('abc'), ':t'))
enddef
@@ -3600,13 +3597,13 @@ def Test_uniq()
enddef
def Test_values()
- CheckDefFailure(['values([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['values([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1')
assert_equal([], {}->values())
assert_equal(['sun'], {star: 'sun'}->values())
enddef
def Test_virtcol()
- CheckDefAndScriptFailure2(['virtcol(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['virtcol(1.1)'], 'E1013: Argument 1: type mismatch, expected string but got float', 'E1222: String or List required for argument 1')
new
setline(1, ['abcdefgh'])
cursor(1, 4)
@@ -3618,8 +3615,8 @@ def Test_virtcol()
enddef
def Test_visualmode()
- CheckDefFailure(['visualmode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string')
- CheckDefFailure(['visualmode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number')
+ CheckDefAndScriptFailure2(['visualmode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1212: Bool required for argument 1')
+ CheckDefAndScriptFailure2(['visualmode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1212: Bool required for argument 1')
enddef
def Test_win_execute()
@@ -3627,38 +3624,41 @@ def Test_win_execute()
assert_equal("\n" .. winnr(), 'echo winnr()'->win_execute(win_getid()))
assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()', 'silent'))
assert_equal('', win_execute(342343, 'echo winnr()'))
+ CheckDefAndScriptFailure2(['win_execute("a", "b", "c")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['win_execute(1, 2, "c")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1222: String or List required for argument 2')
+ CheckDefAndScriptFailure2(['win_execute(1, "b", 3)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E1174: String required for argument 3')
enddef
def Test_win_findbuf()
- CheckDefFailure(['win_findbuf("a")'], 'E1013: Argument 1: type mismatch, expected number but got string')
+ CheckDefAndScriptFailure2(['win_findbuf("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
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')
+ CheckDefAndScriptFailure2(['win_getid(".")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['win_getid(1, ".")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
assert_equal(win_getid(), win_getid(1, 1))
enddef
def Test_win_gettype()
- CheckDefAndScriptFailure2(['win_gettype("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['win_gettype("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_win_gotoid()
- CheckDefAndScriptFailure2(['win_gotoid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['win_gotoid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_win_id2tabwin()
- CheckDefAndScriptFailure2(['win_id2tabwin("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['win_id2tabwin("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_win_id2win()
- CheckDefAndScriptFailure2(['win_id2win("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['win_id2win("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_win_screenpos()
- CheckDefAndScriptFailure2(['win_screenpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['win_screenpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_win_splitmove()
@@ -3671,19 +3671,19 @@ def Test_win_splitmove()
enddef
def Test_winbufnr()
- CheckDefAndScriptFailure2(['winbufnr("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['winbufnr("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_winheight()
- CheckDefAndScriptFailure2(['winheight("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['winheight("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_winlayout()
- CheckDefAndScriptFailure2(['winlayout("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['winlayout("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_winnr()
- CheckDefFailure(['winnr([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
+ CheckDefAndScriptFailure2(['winnr([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 1')
assert_equal(1, winnr())
assert_equal(1, winnr('$'))
enddef
@@ -3698,7 +3698,7 @@ def Test_winrestcmd()
enddef
def Test_winrestview()
- CheckDefFailure(['winrestview([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
+ CheckDefAndScriptFailure2(['winrestview([])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 1')
:%d _
setline(1, 'Hello World')
winrestview({lnum: 1, col: 6})
@@ -3715,12 +3715,12 @@ def Test_winsaveview()
enddef
def Test_winwidth()
- CheckDefAndScriptFailure2(['winwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['winwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
enddef
def Test_xor()
- CheckDefAndScriptFailure2(['xor("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
- CheckDefAndScriptFailure2(['xor(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['xor("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['xor(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index c0ab29ea2..4c55eb6c2 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -604,7 +604,7 @@ def Test_try_catch_throw()
endtry
END
CheckScriptSuccess(lines)
- assert_match('E808: Number or Float required', g:caught)
+ assert_match('E1219: Float or Number required for argument 1', g:caught)
unlet g:caught
# missing catch and/or finally
diff --git a/src/testing.c b/src/testing.c
index 1da1c1cab..1037c44a8 100644
--- a/src/testing.c
+++ b/src/testing.c
@@ -278,9 +278,17 @@ assert_match_common(typval_T *argvars, assert_type_T atype)
char_u buf1[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
int called_emsg_before = called_emsg;
- char_u *pat = tv_get_string_buf_chk(&argvars[0], buf1);
- char_u *text = tv_get_string_buf_chk(&argvars[1], buf2);
+ char_u *pat;
+ char_u *text;
+ 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 1;
+
+ pat = tv_get_string_buf_chk(&argvars[0], buf1);
+ text = tv_get_string_buf_chk(&argvars[1], buf2);
if (called_emsg == called_emsg_before
&& pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH))
{
@@ -376,6 +384,9 @@ assert_beeps(typval_T *argvars, int no_beep)
void
f_assert_beeps(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = assert_beeps(argvars, FALSE);
}
@@ -385,6 +396,9 @@ f_assert_beeps(typval_T *argvars, typval_T *rettv)
void
f_assert_nobeep(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->vval.v_number = assert_beeps(argvars, TRUE);
}
@@ -519,6 +533,12 @@ assert_equalfile(typval_T *argvars)
void
f_assert_equalfile(typval_T *argvars, typval_T *rettv)
{
+ 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;
+
rettv->vval.v_number = assert_equalfile(argvars);
}
@@ -538,8 +558,14 @@ f_assert_notequal(typval_T *argvars, typval_T *rettv)
f_assert_exception(typval_T *argvars, typval_T *rettv)
{
garray_T ga;
- char_u *error = tv_get_string_chk(&argvars[0]);
+ char_u *error;
+
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+ error = tv_get_string_chk(&argvars[0]);
if (*get_vim_var_str(VV_EXCEPTION) == NUL)
{
prepare_assert_error(&ga);
@@ -870,6 +896,12 @@ f_assert_true(typval_T *argvars, typval_T *rettv)
void
f_test_alloc_fail(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_number_arg(argvars, 2) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_NUMBER
|| argvars[0].vval.v_number <= 0
|| argvars[1].v_type != VAR_NUMBER
@@ -905,8 +937,12 @@ f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
{
#ifdef USE_INPUT_BUF
- char_u *val = tv_get_string_chk(&argvars[0]);
+ char_u *val;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
+ val = tv_get_string_chk(&argvars[0]);
# ifdef VIMDLL
// this doesn't work in the console
if (!gui.in_use)
@@ -927,6 +963,9 @@ f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
void
f_test_getvalue(typval_T *argvars, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_STRING)
emsg(_(e_invarg));
else
@@ -948,6 +987,9 @@ f_test_option_not_set(typval_T *argvars, typval_T *rettv UNUSED)
{
char_u *name = (char_u *)"";
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_STRING)
emsg(_(e_invarg));
else
@@ -1125,6 +1167,9 @@ f_test_garbagecollect_soon(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
void
f_test_ignore_error(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_STRING)
emsg(_(e_invarg));
else
@@ -1248,6 +1293,11 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
void
f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script()
+ && (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_number_arg(argvars, 1) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_NUMBER || (argvars[1].v_type) != VAR_NUMBER)
{
emsg(_(e_invarg));
@@ -1288,6 +1338,9 @@ f_test_gui_mouse_event(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
void
f_test_settime(typval_T *argvars, typval_T *rettv UNUSED)
{
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
time_for_testing = (time_t)tv_get_number(&argvars[0]);
}
diff --git a/src/textprop.c b/src/textprop.c
index fdbb14df8..4cde75544 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -618,6 +618,11 @@ f_prop_find(typval_T *argvars, typval_T *rettv)
int dir = 1; // 1 = forward, -1 = backward
int both;
+ if (in_vim9script()
+ && (check_for_dict_arg(argvars, 0) == FAIL
+ || check_for_opt_string_arg(argvars, 1) == FAIL))
+ return;
+
if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL)
{
emsg(_(e_dictreq));
@@ -985,6 +990,11 @@ prop_type_set(typval_T *argvars, int add)
dictitem_T *di;
proptype_T *prop;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_dict_arg(argvars, 1) == FAIL))
+ return;
+
name = tv_get_string(&argvars[0]);
if (*name == NUL)
{
@@ -1115,6 +1125,11 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
buf_T *buf = NULL;
hashitem_T *hi;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
+
name = tv_get_string(&argvars[0]);
if (*name == NUL)
{
@@ -1149,8 +1164,14 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
void
f_prop_type_get(typval_T *argvars, typval_T *rettv)
{
- char_u *name = tv_get_string(&argvars[0]);
+ char_u *name;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
+
+ name = tv_get_string(&argvars[0]);
if (*name == NUL)
{
emsg(_(e_invarg));
@@ -1216,6 +1237,9 @@ f_prop_type_list(typval_T *argvars, typval_T *rettv UNUSED)
if (rettv_list_alloc(rettv) == OK)
{
+ if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (get_bufnr_from_arg(&argvars[0], &buf) == FAIL)
diff --git a/src/time.c b/src/time.c
index 6557b0e8c..ecd884f0f 100644
--- a/src/time.c
+++ b/src/time.c
@@ -174,6 +174,12 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
if (rettv_list_alloc(rettv) != OK)
return;
+ if (in_vim9script()
+ && (check_for_opt_list_arg(argvars, 0) == FAIL
+ || (argvars[0].v_type != VAR_UNKNOWN
+ && check_for_opt_list_arg(argvars, 1) == FAIL)))
+ return;
+
if (argvars[0].v_type == VAR_UNKNOWN)
{
// No arguments: get current time.
@@ -228,6 +234,9 @@ f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv)
rettv->v_type = VAR_FLOAT;
rettv->vval.v_float = 0;
# ifdef FEAT_RELTIME
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (list2proftime(&argvars[0], &tm) == OK)
rettv->vval.v_float = profile_float(&tm);
else if (in_vim9script())
@@ -249,6 +258,9 @@ f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
# ifdef FEAT_RELTIME
+ if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
+ return;
+
if (list2proftime(&argvars[0], &tm) == OK)
rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm));
else if (in_vim9script())
@@ -342,6 +354,11 @@ f_strptime(typval_T *argvars, typval_T *rettv)
vimconv_T conv;
char_u *enc;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_string_arg(argvars, 1) == FAIL))
+ return;
+
CLEAR_FIELD(tmval);
tmval.tm_isdst = -1;
fmt = tv_get_string(&argvars[0]);
@@ -754,6 +771,10 @@ f_timer_info(typval_T *argvars, typval_T *rettv)
if (rettv_list_alloc(rettv) != OK)
return;
+
+ if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_UNKNOWN)
{
if (argvars[0].v_type != VAR_NUMBER)
@@ -849,6 +870,9 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
{
timer_T *timer;
+ if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
+ return;
+
if (argvars[0].v_type != VAR_NUMBER)
{
emsg(_(e_number_expected));
diff --git a/src/typval.c b/src/typval.c
index abda5f050..34032177d 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -430,7 +430,7 @@ check_for_float_or_nr_arg(typval_T *args, int idx)
if (args[idx].v_type != VAR_FLOAT && args[idx].v_type != VAR_NUMBER)
{
if (idx >= 0)
- semsg(_(e_number_required_for_argument_nr), idx + 1);
+ semsg(_(e_float_or_number_required_for_argument_nr), idx + 1);
else
emsg(_(e_numberreq));
return FAIL;
@@ -568,6 +568,16 @@ check_for_job_arg(typval_T *args, int idx)
}
/*
+ * Check for an optional job argument at 'idx'.
+ */
+ int
+check_for_opt_job_arg(typval_T *args, int idx)
+{
+ return (args[idx].v_type == VAR_UNKNOWN
+ || check_for_job_arg(args, idx) != FAIL);
+}
+
+/*
* Give an error and return FAIL unless "args[idx]" is a string or
* a number.
*/
@@ -577,7 +587,7 @@ 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);
+ semsg(_(e_string_or_number_required_for_argument_nr), idx + 1);
else
emsg(_(e_stringreq));
return FAIL;
@@ -644,7 +654,7 @@ 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);
+ semsg(_(e_string_or_blob_required_for_argument_nr), idx + 1);
else
emsg(_(e_stringreq));
return FAIL;
@@ -661,7 +671,7 @@ check_for_string_or_list_arg(typval_T *args, int idx)
if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_LIST)
{
if (idx >= 0)
- semsg(_(e_string_required_for_argument_nr), idx + 1);
+ semsg(_(e_string_or_list_required_for_argument_nr), idx + 1);
else
emsg(_(e_stringreq));
return FAIL;
@@ -680,6 +690,63 @@ check_for_opt_string_or_list_arg(typval_T *args, int idx)
}
/*
+ * Give an error and return FAIL unless "args[idx]" is a string or a dict.
+ */
+ int
+check_for_string_or_dict_arg(typval_T *args, int idx)
+{
+ if (args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_DICT)
+ {
+ if (idx >= 0)
+ semsg(_(e_string_or_dict_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
+ * or a list.
+ */
+ int
+check_for_string_or_number_or_list_arg(typval_T *args, int idx)
+{
+ if (args[idx].v_type != VAR_STRING
+ && args[idx].v_type != VAR_NUMBER
+ && args[idx].v_type != VAR_LIST)
+ {
+ if (idx >= 0)
+ semsg(_(e_string_or_number_or_list_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 list
+ * or a dict.
+ */
+ int
+check_for_string_or_list_or_dict_arg(typval_T *args, int idx)
+{
+ if (args[idx].v_type != VAR_STRING
+ && args[idx].v_type != VAR_LIST
+ && args[idx].v_type != VAR_DICT)
+ {
+ if (idx >= 0)
+ semsg(_(e_string_or_list_or_dict_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 list or a blob.
*/
int
@@ -688,7 +755,25 @@ check_for_list_or_blob_arg(typval_T *args, int idx)
if (args[idx].v_type != VAR_LIST && args[idx].v_type != VAR_BLOB)
{
if (idx >= 0)
- semsg(_(e_list_required_for_argument_nr), idx + 1);
+ semsg(_(e_list_or_blob_required_for_argument_nr), idx + 1);
+ else
+ emsg(_(e_listreq));
+ return FAIL;
+ }
+ return OK;
+}
+
+/*
+ * Give an error and return FAIL unless "args[idx]" is a list or dict
+ */
+ int
+check_for_list_or_dict_arg(typval_T *args, int idx)
+{
+ if (args[idx].v_type != VAR_LIST
+ && args[idx].v_type != VAR_DICT)
+ {
+ if (idx >= 0)
+ semsg(_(e_list_or_dict_required_for_argument_nr), idx + 1);
else
emsg(_(e_listreq));
return FAIL;
@@ -708,7 +793,7 @@ check_for_list_or_dict_or_blob_arg(typval_T *args, int idx)
&& args[idx].v_type != VAR_BLOB)
{
if (idx >= 0)
- semsg(_(e_list_required_for_argument_nr), idx + 1);
+ semsg(_(e_list_or_dict_or_blob_required_for_argument_nr), idx + 1);
else
emsg(_(e_listreq));
return FAIL;
@@ -717,13 +802,14 @@ check_for_list_or_dict_or_blob_arg(typval_T *args, int idx)
}
/*
- * Give an error and return FAIL unless "args[idx]" is a buffer number or a
- * dict.
+ * Give an error and return FAIL unless "args[idx]" is an optional buffer
+ * number or a dict.
*/
int
-check_for_buffer_or_dict_arg(typval_T *args, int idx)
+check_for_opt_buffer_or_dict_arg(typval_T *args, int idx)
{
- if (args[idx].v_type != VAR_STRING
+ if (args[idx].v_type != VAR_UNKNOWN
+ && args[idx].v_type != VAR_STRING
&& args[idx].v_type != VAR_NUMBER
&& args[idx].v_type != VAR_DICT)
{
diff --git a/src/undo.c b/src/undo.c
index 171e81776..814130108 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -3646,6 +3646,9 @@ u_eval_tree(u_header_T *first_uhp, list_T *list)
void
f_undofile(typval_T *argvars UNUSED, typval_T *rettv)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
rettv->v_type = VAR_STRING;
#ifdef FEAT_PERSISTENT_UNDO
{
diff --git a/src/version.c b/src/version.c
index e38274ef3..a628f5116 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3229,
+/**/
3228,
/**/
3227,