mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2012: Vim9: confusing error message when using bool wrongly
Problem: Vim9: confusing error message when using bool wrongly. Solution: Mention "Bool" instead of "Special". (closes #7323)
This commit is contained in:
parent
9950280d37
commit
d92cc130fb
@ -301,3 +301,5 @@ EXTERN char e_cmd_mapping_must_end_with_cr_before_second_cmd[]
|
||||
INIT(=N_("E1136: <Cmd> mapping must end with <CR> before second <Cmd>"));
|
||||
EXTERN char e_cmd_maping_must_not_include_str_key[]
|
||||
INIT(= N_("E1137: <Cmd> mapping must not include %s key"));
|
||||
EXTERN char e_using_bool_as_number[]
|
||||
INIT(= N_("E1138: Using a Bool as a Number"));
|
||||
|
@ -1292,6 +1292,13 @@ func Test_expr5_fails()
|
||||
call CheckDefFailure(["var x = 'a' .. 0z32"], 'E1105:', 1)
|
||||
call CheckDefFailure(["var x = 'a' .. function('len')"], 'E1105:', 1)
|
||||
call CheckDefFailure(["var x = 'a' .. function('len', ['a'])"], 'E1105:', 1)
|
||||
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + v:none'], 'E611:', 2)
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + v:null'], 'E611:', 2)
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + v:true'], 'E1138:', 2)
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + v:false'], 'E1138:', 2)
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + true'], 'E1138:', 2)
|
||||
call CheckScriptFailure(['vim9script', 'var x = 1 + false'], 'E1138:', 2)
|
||||
endfunc
|
||||
|
||||
func Test_expr5_fails_channel()
|
||||
|
@ -213,7 +213,10 @@ tv_get_bool_or_number_chk(typval_T *varp, int *denote, int want_bool)
|
||||
case VAR_SPECIAL:
|
||||
if (!want_bool && in_vim9script())
|
||||
{
|
||||
emsg(_("E611: Using a Special as a Number"));
|
||||
if (varp->v_type == VAR_BOOL)
|
||||
emsg(_(e_using_bool_as_number));
|
||||
else
|
||||
emsg(_("E611: Using a Special as a Number"));
|
||||
break;
|
||||
}
|
||||
return varp->vval.v_number == VVAL_TRUE ? 1 : 0;
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2012,
|
||||
/**/
|
||||
2011,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user