Patch 9.0.1107
Problem: Float constant not recognized as float.
Solution: Check the vartype instead of comparing with t_float.
(closes #11754)
Files: src/vim9expr.c, src/testdir/test_vim9_expr.vim
*** ../vim-9.0.1106/src/vim9expr.c 2022-12-18 21:42:49.014716925 +0000
--- src/vim9expr.c 2022-12-27 20:52:24.052841853 +0000
***************
*** 1757,1778 ****
--p;
if (*p == '-' || *p == '+')
{
! int negate = *p == '-';
! isn_T *isn;
! type_T *type;
!
! type = get_type_on_stack(cctx, 0);
! if (type != &t_float && need_type(type, &t_number,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;
// only '-' has an effect, for '+' we only check the type
! if (negate)
! {
! isn = generate_instr(cctx, ISN_NEGATENR);
! if (isn == NULL)
! return FAIL;
! }
}
else if (numeric_only)
{
--- 1757,1770 ----
--p;
if (*p == '-' || *p == '+')
{
! type_T *type = get_type_on_stack(cctx, 0);
! if (type->tt_type != VAR_FLOAT && need_type(type, &t_number,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;
// only '-' has an effect, for '+' we only check the type
! if (*p == '-' && generate_instr(cctx, ISN_NEGATENR) == NULL)
! return FAIL;
}
else if (numeric_only)
{
*** ../vim-9.0.1106/src/testdir/test_vim9_expr.vim 2022-11-12
16:07:01.781944372 +0000
--- src/testdir/test_vim9_expr.vim 2022-12-27 20:49:34.272795131 +0000
***************
*** 2045,2050 ****
--- 2045,2057 ----
assert_equal(6, 0x6)
assert_equal(15, 0xf)
assert_equal(255, 0xff)
+
+ const INFTY = 1.0 / 0.0
+ def Test()
+ assert_equal(1, isinf(INFTY))
+ assert_equal(-1, isinf(-INFTY))
+ enddef
+ Test()
END
v9.CheckDefAndScriptSuccess(lines)
enddef
*** ../vim-9.0.1106/src/version.c 2022-12-27 20:17:15.809022036 +0000
--- src/version.c 2022-12-27 20:47:43.812723827 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1107,
/**/
--
Lose weight, NEVER Diet again with
The "Invisible Weight Loss Patch"
(spam e-mail)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20221227205609.8A0AC1C0AA3%40moolenaar.net.