patch 9.1.2122: Vim9: Negating a float doesn't result in a bool

Commit: 
https://github.com/vim/vim/commit/3a5e57fc7eeaf67175223abc2bf7752891297721
Author: Yegappan Lakshmanan <[email protected]>
Date:   Sat Jan 31 10:25:50 2026 +0000

    patch 9.1.2122: Vim9: Negating a float doesn't result in a bool
    
    Problem:  Vim9: Negating a float doesn't result in a boolean
              (kennypete)
    Solution: Make it return a boolean (Yegappan Lakshmanan).
    
    related: #19282
    related: #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 d2f06fd11..71bd35370 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5421,6 +5421,7 @@ eval9_leader(
                    {
                        rettv->v_type = VAR_BOOL;
                        val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
+                       type = VAR_BOOL;
                    }
                    else
                        f = !f;
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 4551ea5eb..ab0b02a6d 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -4117,6 +4117,11 @@ def Test_expr9_not()
 
       assert_equal(false, ![1, 2, 3]->reverse())
       assert_equal(true, ![]->reverse())
+
+      # float
+      assert_equal(true, !0.0)
+      assert_equal(false, !1.0)
+      assert_equal(false, !25.678)
   END
   v9.CheckDefAndScriptSuccess(lines)
 enddef
diff --git a/src/version.c b/src/version.c
index 827956351..78ae26eef 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 */
+/**/
+    2122,
 /**/
     2121,
 /**/

-- 
-- 
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/E1vm8TP-005PbR-BX%40256bit.org.

Raspunde prin e-mail lui