]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2123: using NOT with a float returns a float in legacy script master v9.1.2123
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 31 Jan 2026 10:29:01 +0000 (10:29 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 31 Jan 2026 10:29:01 +0000 (10:29 +0000)
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>
src/eval.c
src/testdir/test_vimscript.vim
src/version.c

index 71bd3537016f7a981e694c42a64500a995838d9b..488818a4b05cc87f4527d6150166ba7ab02ff414 100644 (file)
@@ -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
                {
index 0be53dc5a36235235064f6863b3cb4b26b55941c..a79c6827911ba0dbc2ad7386787b0d030f0bf400 100644 (file)
@@ -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
index 78ae26eef07c33fdb68b9842339f9eb99ed5da34..5dc95056bb9a3f8a3a0059f9a8f2e6bf30841267 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2123,
 /**/
     2122,
 /**/