Patch 8.2.2297
Problem:    Vim9: cannot set 'number' to a boolean value.
Solution:   Use tv_get_bool(). (closes #7615)
Files:      src/evalvars.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2296/src/evalvars.c      2021-01-03 21:53:28.279020545 +0100
--- src/evalvars.c      2021-01-04 13:32:45.256178799 +0100
***************
*** 1370,1377 ****
                        || opt_type == gov_hidden_bool
                        || opt_type == gov_hidden_number)
                             && (tv->v_type != VAR_STRING || !in_vim9script()))
!               // number, possibly hidden
!               n = (long)tv_get_number(tv);
  
            // Avoid setting a string option to the text "v:false" or similar.
            // In Vim9 script also don't convert a number to string.
--- 1370,1383 ----
                        || opt_type == gov_hidden_bool
                        || opt_type == gov_hidden_number)
                             && (tv->v_type != VAR_STRING || !in_vim9script()))
!           {
!               if (opt_type == gov_bool || opt_type == gov_hidden_bool)
!                   // bool, possibly hidden
!                   n = (long)tv_get_bool(tv);
!               else
!                   // number, possibly hidden
!                   n = (long)tv_get_number(tv);
!           }
  
            // Avoid setting a string option to the text "v:false" or similar.
            // In Vim9 script also don't convert a number to string.
*** ../vim-8.2.2296/src/testdir/test_vim9_assign.vim    2021-01-03 
20:55:22.807151946 +0100
--- src/testdir/test_vim9_assign.vim    2021-01-04 13:35:28.183606626 +0100
***************
*** 161,166 ****
--- 161,175 ----
      assert_equal(6, &g:ts)
      &g:ts += 2
      assert_equal(8, &g:ts)
+ 
+     &number = true
+     assert_equal(true, &number)
+     &number = 0
+     assert_equal(false, &number)
+     &number = 1
+     assert_equal(true, &number)
+     &number = false
+     assert_equal(false, &number)
    END
    CheckDefAndScriptSuccess(lines)
  
*** ../vim-8.2.2296/src/version.c       2021-01-04 13:17:48.811309247 +0100
--- src/version.c       2021-01-04 13:36:21.907417869 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2297,
  /**/

-- 
Momento mori, ergo carpe diem

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101041238.104CcTTM2424436%40masaka.moolenaar.net.

Raspunde prin e-mail lui