mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.1.2123: using NOT with a float returns a float in legacy script
Problem: using NOT with a float returns a float in legacy vim script
(kennypete)
Solution: Return a number instead of a float (Yegappan Lakshmanan)
fixes: #19282
closes: #19289
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
3a5e57fc7e
commit
ecc3faef61
+3
-8
@@ -5417,14 +5417,9 @@ eval9_leader(
|
||||
}
|
||||
if (rettv->v_type == VAR_FLOAT)
|
||||
{
|
||||
if (vim9script)
|
||||
{
|
||||
rettv->v_type = VAR_BOOL;
|
||||
val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
|
||||
type = VAR_BOOL;
|
||||
}
|
||||
else
|
||||
f = !f;
|
||||
rettv->v_type = VAR_BOOL;
|
||||
val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
|
||||
type = VAR_BOOL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7086,7 +7086,11 @@ func Test_compound_assignment_operators()
|
||||
call assert_fails('let x %= 0.5', 'E734:')
|
||||
call assert_fails('let x .= "f"', 'E734:')
|
||||
let x = !3.14
|
||||
call assert_equal(0.0, x)
|
||||
call assert_equal(0, x)
|
||||
call assert_equal(1, !!1.0)
|
||||
let x = !0.0
|
||||
call assert_equal(1, x)
|
||||
call assert_equal(0, !!0.0)
|
||||
|
||||
" integer and float operations
|
||||
let x = 1
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2123,
|
||||
/**/
|
||||
2122,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user