diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-09-02 15:15:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-02 15:15:27 +0100 |
commit | 8deb2b30c77035bb682ccf80b781455ac1d6038b (patch) | |
tree | 66a1d18ad9971c123f42bd7879c56706e19be73b /src | |
parent | 119167265ebc7eced210a7f8ed2f4b90378f98f1 (diff) | |
download | vim-git-8deb2b30c77035bb682ccf80b781455ac1d6038b.tar.gz |
patch 9.0.0359: error message for wrong argument type is not specificv9.0.0359
Problem: Error message for wrong argument type is not specific.
Solution: Include more information in the error. (Yegappan Lakshmanan,
closes #11037)
Diffstat (limited to 'src')
-rw-r--r-- | src/blob.c | 5 | ||||
-rw-r--r-- | src/cmdexpand.c | 5 | ||||
-rw-r--r-- | src/evalfunc.c | 35 | ||||
-rw-r--r-- | src/popupwin.c | 4 | ||||
-rw-r--r-- | src/sign.c | 13 | ||||
-rw-r--r-- | src/strings.c | 22 | ||||
-rw-r--r-- | src/testdir/test_assert.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_cmdline.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_functions.vim | 14 | ||||
-rw-r--r-- | src/testdir/test_listdict.vim | 12 | ||||
-rw-r--r-- | src/testdir/test_signs.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_tagjump.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_timers.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 4 | ||||
-rw-r--r-- | src/testing.c | 160 | ||||
-rw-r--r-- | src/time.c | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
17 files changed, 115 insertions, 193 deletions
diff --git a/src/blob.c b/src/blob.c index 0d88c757a..cfc3d372d 100644 --- a/src/blob.c +++ b/src/blob.c @@ -667,11 +667,8 @@ blob_reduce( initial.vval.v_number = blob_get(b, 0); i = 1; } - else if (argvars[2].v_type != VAR_NUMBER) - { - emsg(_(e_number_expected)); + else if (check_for_number_arg(argvars, 2) == FAIL) return; - } else { initial = argvars[2]; diff --git a/src/cmdexpand.c b/src/cmdexpand.c index bfa30533b..57bf47a1b 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -3679,11 +3679,8 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) return; pat = tv_get_string(&argvars[0]); - if (argvars[1].v_type != VAR_STRING) - { - semsg(_(e_invalid_argument_str), "type must be a string"); + if (check_for_string_arg(argvars, 1) == FAIL) return; - } type = tv_get_string(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) diff --git a/src/evalfunc.c b/src/evalfunc.c index c7cf32297..7c122e1b4 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3607,17 +3607,13 @@ f_deepcopy(typval_T *argvars, typval_T *rettv) { varnumber_T noref = 0; - if (in_vim9script() - && (check_for_opt_bool_arg(argvars, 1) == FAIL)) + if (check_for_opt_bool_arg(argvars, 1) == FAIL) return; if (argvars[1].v_type != VAR_UNKNOWN) noref = tv_get_bool_chk(&argvars[1], NULL); - if (noref < 0 || noref > 1) - semsg(_(e_using_number_as_bool_nr), noref); - else - item_copy(&argvars[0], rettv, TRUE, TRUE, - noref == 0 ? get_copyID() : 0); + + item_copy(&argvars[0], rettv, TRUE, TRUE, noref == 0 ? get_copyID() : 0); } /* @@ -5257,21 +5253,11 @@ 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) + if (check_for_nonempty_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) - { - semsg(_(e_invalid_argument_str), tv_get_string(&argvars[0])); - } - else - { - rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave( - (char_u *)_(argvars[0].vval.v_string)); - } + rettv->v_type = VAR_STRING; + rettv->vval.v_string = vim_strsave((char_u *)_(argvars[0].vval.v_string)); } // for VIM_VERSION_ defines @@ -9641,7 +9627,9 @@ f_settagstack(typval_T *argvars, typval_T *rettv) // default is to replace the stack. if (argvars[2].v_type == VAR_UNKNOWN) action = 'r'; - else if (argvars[2].v_type == VAR_STRING) + else if (check_for_string_arg(argvars, 2) == FAIL) + return; + else { char_u *actstr; actstr = tv_get_string_chk(&argvars[2]); @@ -9656,11 +9644,6 @@ f_settagstack(typval_T *argvars, typval_T *rettv) return; } } - else - { - emsg(_(e_string_required)); - return; - } if (set_tagstack(wp, d, action) == OK) rettv->vval.v_number = 0; diff --git a/src/popupwin.c b/src/popupwin.c index 8688f3e3d..5f003803b 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2769,9 +2769,7 @@ f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED) wp = find_popup_win(id); if (wp != NULL) { - if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_LIST) - semsg(_(e_invalid_argument_str), tv_get_string(&argvars[1])); - else + if (check_for_string_or_list_arg(argvars, 1) != FAIL) { popup_set_buffer_text(wp->w_buffer, argvars[1]); redraw_win_later(wp, UPD_NOT_VALID); diff --git a/src/sign.c b/src/sign.c index eaefd5f06..1073e6529 100644 --- a/src/sign.c +++ b/src/sign.c @@ -2849,23 +2849,12 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() - && (check_for_string_arg(argvars, 0) == FAIL + if ((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_invalid_argument)); - return; - } - if (argvars[1].v_type != VAR_UNKNOWN) - { - if (check_for_dict_arg(argvars, 1) == FAIL) - return; dict = argvars[1].vval.v_dict; - } rettv->vval.v_number = sign_unplace_from_dict(&argvars[0], dict); } diff --git a/src/strings.c b/src/strings.c index 0313e7480..55ee69ab1 100644 --- a/src/strings.c +++ b/src/strings.c @@ -960,11 +960,8 @@ string_reduce( return; p += STRLEN(rettv->vval.v_string); } - else if (argvars[2].v_type != VAR_STRING) - { - semsg(_(e_string_expected_for_argument_nr), 3); + else if (check_for_string_arg(argvars, 2) == FAIL) return; - } else copy_tv(&argvars[2], rettv); @@ -1047,21 +1044,11 @@ f_charidx(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() - && (check_for_string_arg(argvars, 0) == FAIL + if ((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 - && argvars[2].v_type != VAR_BOOL)) - { - emsg(_(e_invalid_argument)); - return; - } - str = tv_get_string_chk(&argvars[0]); idx = tv_get_number_chk(&argvars[1], NULL); if (str == NULL || idx < 0) @@ -1783,11 +1770,8 @@ f_trim(typval_T *argvars, typval_T *rettv) if (head == NULL) return; - if (argvars[1].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_STRING) - { - semsg(_(e_invalid_argument_str), tv_get_string(&argvars[1])); + if (check_for_opt_string_arg(argvars, 1) == FAIL) return; - } if (argvars[1].v_type == VAR_STRING) { diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 7c9d090b3..f11a3a936 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -368,7 +368,7 @@ func Test_override() eval 1->test_override('redraw') call test_override('ALL', 0) call assert_fails("call test_override('xxx', 1)", 'E475:') - call assert_fails("call test_override('redraw', 'yes')", 'E474:') + call assert_fails("call test_override('redraw', 'yes')", 'E1210:') endfunc func Test_mouse_position() diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index bec0f5fdf..335e756d6 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -605,7 +605,7 @@ func Test_getcompletion() call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:') call assert_fails('call getcompletion("", "burp")', 'E475:') - call assert_fails('call getcompletion("abc", [])', 'E475:') + call assert_fails('call getcompletion("abc", [])', 'E1174:') endfunc " Test for getcompletion() with "fuzzy" in 'wildoptions' diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 43eb265d6..e05268a74 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1247,11 +1247,11 @@ func Test_charidx() call assert_equal(-1, charidx(a, 8, 1)) call assert_equal(-1, charidx('', 0, 1)) - call assert_fails('let x = charidx([], 1)', 'E474:') - call assert_fails('let x = charidx("abc", [])', 'E474:') - call assert_fails('let x = charidx("abc", 1, [])', 'E474:') - call assert_fails('let x = charidx("abc", 1, -1)', 'E1023:') - call assert_fails('let x = charidx("abc", 1, 2)', 'E1023:') + call assert_fails('let x = charidx([], 1)', 'E1174:') + call assert_fails('let x = charidx("abc", [])', 'E1210:') + call assert_fails('let x = charidx("abc", 1, [])', 'E1212:') + call assert_fails('let x = charidx("abc", 1, -1)', 'E1212:') + call assert_fails('let x = charidx("abc", 1, 2)', 'E1212:') endfunc func Test_count() @@ -1738,7 +1738,7 @@ func Test_trim() call assert_fails('eval trim(" vim ", " ", [])', 'E745:') call assert_fails('eval trim(" vim ", " ", -1)', 'E475:') call assert_fails('eval trim(" vim ", " ", 3)', 'E475:') - call assert_fails('eval trim(" vim ", 0)', 'E475:') + call assert_fails('eval trim(" vim ", 0)', 'E1174:') let chars = join(map(range(1, 0x20) + [0xa0], {n -> n->nr2char()}), '') call assert_equal("x", trim(chars . "x" . chars)) @@ -2913,7 +2913,7 @@ endfunc " Test for gettext() func Test_gettext() - call assert_fails('call gettext(1)', 'E475:') + call assert_fails('call gettext(1)', 'E1174:') endfunc func Test_builtin_check() diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim index 154aa9875..bf3117bbb 100644 --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -568,7 +568,7 @@ func Test_dict_deepcopy() END call v9.CheckLegacyAndVim9Success(lines) - call assert_fails("call deepcopy([1, 2], 2)", 'E1023:') + call assert_fails("call deepcopy([1, 2], 2)", 'E1212:') endfunc " Locked variables @@ -1044,16 +1044,16 @@ func Test_reduce() call assert_fails("call reduce({}, { acc, val -> acc + val }, 1)", 'E1098:') call assert_fails("call reduce(0, { acc, val -> acc + val }, 1)", 'E1098:') call assert_fails("call reduce([1, 2], 'Xdoes_not_exist')", 'E117:') - call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E39:') + call assert_fails("echo reduce(0z01, { acc, val -> 2 * acc + val }, '')", 'E1210:') call assert_fails("vim9 reduce(0, (acc, val) => (acc .. val), '')", 'E1252:') call assert_fails("vim9 reduce({}, (acc, val) => (acc .. val), '')", 'E1252:') call assert_fails("vim9 reduce(0.1, (acc, val) => (acc .. val), '')", 'E1252:') call assert_fails("vim9 reduce(function('tr'), (acc, val) => (acc .. val), '')", 'E1252:') - call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, {})", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, 0.1)", 'E1253:') - call assert_fails("call reduce('', { acc, val -> acc + val }, function('tr'))", 'E1253:') + call assert_fails("call reduce('', { acc, val -> acc + val }, 1)", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, {})", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, 0.1)", 'E1174:') + call assert_fails("call reduce('', { acc, val -> acc + val }, function('tr'))", 'E1174:') call assert_fails("call reduce('abc', { a, v -> a10}, '')", 'E121:') call assert_fails("call reduce(0z0102, { a, v -> a10}, 1)", 'E121:') call assert_fails("call reduce([1, 2], { a, v -> a10}, '')", 'E121:') diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim index e2387b28c..790d9b437 100644 --- a/src/testdir/test_signs.vim +++ b/src/testdir/test_signs.vim @@ -686,7 +686,7 @@ func Test_sign_group() call assert_equal([], sign_getplaced(bnum, {'group' : '*'})[0].signs) " Error case - call assert_fails("call sign_unplace({})", 'E474:') + call assert_fails("call sign_unplace({})", 'E1174:') " Place a sign in the global group and try to delete it using a group call assert_equal(5, sign_place(5, '', 'sign1', bnum, {'lnum' : 10})) diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim index cca907f3b..81606fcf7 100644 --- a/src/testdir/test_tagjump.vim +++ b/src/testdir/test_tagjump.vim @@ -405,7 +405,7 @@ func Test_getsettagstack() call assert_equal(-1, settagstack(100, {'items' : []})) call assert_fails('call settagstack(1, [1, 10])', 'E1206:') call assert_fails("call settagstack(1, {'items' : 10})", 'E714:') - call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928:') + call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E1174:') call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:') call assert_equal(-1, settagstack(0, test_null_dict())) diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 85e76eb86..2625013ae 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -116,7 +116,7 @@ func Test_timer_info() call timer_stop(id) call assert_equal([], timer_info(id)) - call assert_fails('call timer_info("abc")', 'E39:') + call assert_fails('call timer_info("abc")', 'E1210:') " check repeat count inside the callback let g:timer_repeat = [] @@ -267,7 +267,7 @@ func Test_timer_errors() call assert_fails('call timer_start(100, "MyHandler", "abc")', 'E1206:') call assert_fails('call timer_start(100, [])', 'E921:') - call assert_fails('call timer_stop("abc")', 'E39:') + call assert_fails('call timer_stop("abc")', 'E1210:') endfunc func FuncWithCaughtError(timer) diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 13f87cb8e..b74a8eced 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -1961,9 +1961,9 @@ enddef def Test_gettext() v9.CheckDefAndScriptFailure(['gettext(10)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) - v9.CheckDefExecAndScriptFailure(['gettext("")'], 'E475: Invalid argument') + v9.CheckDefExecAndScriptFailure(['gettext("")'], 'E1175: Non-empty string required for argument 1') assert_equal('abc', gettext("abc")) - assert_fails('gettext("")', 'E475:') + assert_fails('gettext("")', 'E1175:') enddef def Test_getwininfo() diff --git a/src/testing.c b/src/testing.c index 21eb9c18e..8c682cf6b 100644 --- a/src/testing.c +++ b/src/testing.c @@ -970,20 +970,17 @@ 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) + char_u *name; + + if (check_for_string_arg(argvars, 0) == FAIL) return; - if (argvars[0].v_type != VAR_STRING) - emsg(_(e_invalid_argument)); - else - { - char_u *name = tv_get_string(&argvars[0]); + name = tv_get_string(&argvars[0]); - if (STRCMP(name, (char_u *)"need_fileinfo") == 0) - rettv->vval.v_number = need_fileinfo; - else - semsg(_(e_invalid_argument_str), name); - } + if (STRCMP(name, (char_u *)"need_fileinfo") == 0) + rettv->vval.v_number = need_fileinfo; + else + semsg(_(e_invalid_argument_str), name); } /* @@ -994,17 +991,12 @@ 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) + if (check_for_string_arg(argvars, 0) == FAIL) return; - if (argvars[0].v_type != VAR_STRING) - emsg(_(e_invalid_argument)); - else - { - name = tv_get_string(&argvars[0]); - if (reset_option_was_set(name) == FAIL) - semsg(_(e_invalid_argument_str), name); - } + name = tv_get_string(&argvars[0]); + if (reset_option_was_set(name) == FAIL) + semsg(_(e_invalid_argument_str), name); } /* @@ -1017,77 +1009,70 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED) int val; static int save_starting = -1; - if (in_vim9script() - && (check_for_string_arg(argvars, 0) == FAIL - || check_for_number_arg(argvars, 1) == FAIL)) + if (check_for_string_arg(argvars, 0) == FAIL + || check_for_number_arg(argvars, 1) == FAIL) return; - if (argvars[0].v_type != VAR_STRING - || (argvars[1].v_type) != VAR_NUMBER) - emsg(_(e_invalid_argument)); - else + name = tv_get_string(&argvars[0]); + val = (int)tv_get_number(&argvars[1]); + + if (STRCMP(name, (char_u *)"redraw") == 0) + disable_redraw_for_testing = val; + else if (STRCMP(name, (char_u *)"redraw_flag") == 0) + ignore_redraw_flag_for_testing = val; + else if (STRCMP(name, (char_u *)"char_avail") == 0) + disable_char_avail_for_testing = val; + else if (STRCMP(name, (char_u *)"starting") == 0) { - name = tv_get_string(&argvars[0]); - val = (int)tv_get_number(&argvars[1]); - - if (STRCMP(name, (char_u *)"redraw") == 0) - disable_redraw_for_testing = val; - else if (STRCMP(name, (char_u *)"redraw_flag") == 0) - ignore_redraw_flag_for_testing = val; - else if (STRCMP(name, (char_u *)"char_avail") == 0) - disable_char_avail_for_testing = val; - else if (STRCMP(name, (char_u *)"starting") == 0) + if (val) { - if (val) - { - if (save_starting < 0) - save_starting = starting; - starting = 0; - } - else - { - starting = save_starting; - save_starting = -1; - } + if (save_starting < 0) + save_starting = starting; + starting = 0; } - else if (STRCMP(name, (char_u *)"nfa_fail") == 0) - nfa_fail_for_testing = val; - else if (STRCMP(name, (char_u *)"no_query_mouse") == 0) - no_query_mouse_for_testing = val; - else if (STRCMP(name, (char_u *)"no_wait_return") == 0) - no_wait_return = val; - else if (STRCMP(name, (char_u *)"ui_delay") == 0) - ui_delay_for_testing = val; - else if (STRCMP(name, (char_u *)"term_props") == 0) - reset_term_props_on_termresponse = val; - else if (STRCMP(name, (char_u *)"vterm_title") == 0) - disable_vterm_title_for_testing = val; - else if (STRCMP(name, (char_u *)"uptime") == 0) - override_sysinfo_uptime = val; - else if (STRCMP(name, (char_u *)"alloc_lines") == 0) - ml_get_alloc_lines = val; - else if (STRCMP(name, (char_u *)"autoload") == 0) - override_autoload = val; - else if (STRCMP(name, (char_u *)"ALL") == 0) + else { - disable_char_avail_for_testing = FALSE; - disable_redraw_for_testing = FALSE; - ignore_redraw_flag_for_testing = FALSE; - nfa_fail_for_testing = FALSE; - no_query_mouse_for_testing = FALSE; - ui_delay_for_testing = 0; - reset_term_props_on_termresponse = FALSE; - override_sysinfo_uptime = -1; - // ml_get_alloc_lines is not reset by "ALL" - if (save_starting >= 0) - { - starting = save_starting; - save_starting = -1; - } + starting = save_starting; + save_starting = -1; + } + } + else if (STRCMP(name, (char_u *)"nfa_fail") == 0) + nfa_fail_for_testing = val; + else if (STRCMP(name, (char_u *)"no_query_mouse") == 0) + no_query_mouse_for_testing = val; + else if (STRCMP(name, (char_u *)"no_wait_return") == 0) + no_wait_return = val; + else if (STRCMP(name, (char_u *)"ui_delay") == 0) + ui_delay_for_testing = val; + else if (STRCMP(name, (char_u *)"term_props") == 0) + reset_term_props_on_termresponse = val; + else if (STRCMP(name, (char_u *)"vterm_title") == 0) + disable_vterm_title_for_testing = val; + else if (STRCMP(name, (char_u *)"uptime") == 0) + override_sysinfo_uptime = val; + else if (STRCMP(name, (char_u *)"alloc_lines") == 0) + ml_get_alloc_lines = val; + else if (STRCMP(name, (char_u *)"autoload") == 0) + override_autoload = val; + else if (STRCMP(name, (char_u *)"ALL") == 0) + { + disable_char_avail_for_testing = FALSE; + disable_redraw_for_testing = FALSE; + ignore_redraw_flag_for_testing = FALSE; + nfa_fail_for_testing = FALSE; + no_query_mouse_for_testing = FALSE; + ui_delay_for_testing = 0; + reset_term_props_on_termresponse = FALSE; + override_sysinfo_uptime = -1; + // ml_get_alloc_lines is not reset by "ALL" + if (save_starting >= 0) + { + starting = save_starting; + save_starting = -1; } - else - semsg(_(e_invalid_argument_str), name); } + else + semsg(_(e_invalid_argument_str), name); } /* @@ -1184,13 +1169,10 @@ 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) + if (check_for_string_arg(argvars, 0) == FAIL) return; - if (argvars[0].v_type != VAR_STRING) - emsg(_(e_invalid_argument)); - else - ignore_error_for_testing(tv_get_string(&argvars[0])); + ignore_error_for_testing(tv_get_string(&argvars[0])); } void @@ -1271,7 +1253,7 @@ f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED) || check_for_number_arg(argvars, 1) == FAIL)) return; - if (argvars[0].v_type != VAR_NUMBER || (argvars[1].v_type) != VAR_NUMBER) + if (argvars[0].v_type != VAR_NUMBER || argvars[1].v_type != VAR_NUMBER) { emsg(_(e_invalid_argument)); return; diff --git a/src/time.c b/src/time.c index d97c56e6c..58337c9f6 100644 --- a/src/time.c +++ b/src/time.c @@ -805,19 +805,14 @@ f_timer_info(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) { - if (argvars[0].v_type != VAR_NUMBER) - emsg(_(e_number_expected)); - else - { - timer = find_timer((int)tv_get_number(&argvars[0])); - if (timer != NULL) - add_timer_info(rettv, timer); - } + timer = find_timer((int)tv_get_number(&argvars[0])); + if (timer != NULL) + add_timer_info(rettv, timer); } else add_timer_info_all(rettv); @@ -909,14 +904,9 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED) { timer_T *timer; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (check_for_number_arg(argvars, 0) == FAIL) return; - if (argvars[0].v_type != VAR_NUMBER) - { - emsg(_(e_number_expected)); - return; - } timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) stop_timer(timer); diff --git a/src/version.c b/src/version.c index 202c46db8..fa2d9d54e 100644 --- a/src/version.c +++ b/src/version.c @@ -708,6 +708,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 359, +/**/ 358, /**/ 357, |