patch 9.1.2123: using NOT with a float returns a float in legacy script

Commit: 
https://github.com/vim/vim/commit/ecc3faef61cb02f28028f27184ccd2aadcee7c24
Author: Yegappan Lakshmanan <[email protected]>
Date:   Sat Jan 31 10:29:01 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/eval.c b/src/eval.c
index 71bd35370..488818a4b 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 0be53dc5a..a79c68279 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 78ae26eef..5dc95056b 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,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1vm8TQ-005Pbu-QZ%40256bit.org.

Raspunde prin e-mail lui