From ecc3faef61cb02f28028f27184ccd2aadcee7c24 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 31 Jan 2026 10:29:01 +0000 Subject: [PATCH] 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 Signed-off-by: Christian Brabandt --- src/eval.c | 11 +++-------- src/testdir/test_vimscript.vim | 6 +++++- src/version.c | 2 ++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/eval.c b/src/eval.c index 71bd353701..488818a4b0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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 { diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim index 0be53dc5a3..a79c682791 100644 --- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -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 diff --git a/src/version.c b/src/version.c index 78ae26eef0..5dc95056bb 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2123, /**/ 2122, /**/ -- 2.47.3