Patch 8.2.2012
Problem: Vim9: confusing error message when using bool wrongly.
Solution: Mention "Bool" instead of "Special". (closes #7323)
Files: src/typval.c, src/errors.h, src/testdir/test_vim9_expr.vim
*** ../vim-8.2.2011/src/typval.c 2020-11-12 12:08:47.982254065 +0100
--- src/typval.c 2020-11-18 17:00:49.701298621 +0100
***************
*** 213,219 ****
case VAR_SPECIAL:
if (!want_bool && in_vim9script())
{
! emsg(_("E611: Using a Special as a Number"));
break;
}
return varp->vval.v_number == VVAL_TRUE ? 1 : 0;
--- 213,222 ----
case VAR_SPECIAL:
if (!want_bool && in_vim9script())
{
! 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;
*** ../vim-8.2.2011/src/errors.h 2020-11-12 14:20:32.017927303 +0100
--- src/errors.h 2020-11-18 17:01:09.421229505 +0100
***************
*** 301,303 ****
--- 301,305 ----
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"));
*** ../vim-8.2.2011/src/testdir/test_vim9_expr.vim 2020-11-14
20:57:03.866109771 +0100
--- src/testdir/test_vim9_expr.vim 2020-11-18 17:16:39.574038415 +0100
***************
*** 1292,1297 ****
--- 1292,1304 ----
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()
*** ../vim-8.2.2011/src/version.c 2020-11-18 16:53:19.982914841 +0100
--- src/version.c 2020-11-18 17:14:07.166555604 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2012,
/**/
--
MAN: Fetchez la vache!
GUARD: Quoi?
MAN: Fetchez la vache!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202011181617.0AIGHfmH086772%40masaka.moolenaar.net.