Patch 8.2.1751
Problem:    Using 2 where bool is expected may throw an error.
Solution:   Make this backwards compatible.
Files:      src/typval.c, src/evalfunc.c, src/testdir/test_search.vim,
            src/testdir/test_terminal2.vim


*** ../vim-8.2.1750/src/typval.c        2020-09-16 21:08:23.642361197 +0200
--- src/typval.c        2020-09-26 22:19:18.606126855 +0200
***************
*** 177,183 ****
      switch (varp->v_type)
      {
        case VAR_NUMBER:
!           if (want_bool && varp->vval.v_number != 0
                                                   && varp->vval.v_number != 1)
            {
                semsg(_(e_using_number_as_bool_nr), varp->vval.v_number);
--- 177,183 ----
      switch (varp->v_type)
      {
        case VAR_NUMBER:
!           if (in_vim9script() && want_bool && varp->vval.v_number != 0
                                                   && varp->vval.v_number != 1)
            {
                semsg(_(e_using_number_as_bool_nr), varp->vval.v_number);
*** ../vim-8.2.1750/src/evalfunc.c      2020-09-26 18:47:03.397502458 +0200
--- src/evalfunc.c      2020-09-26 22:33:50.248425066 +0200
***************
*** 1982,1988 ****
      if (argvars[1].v_type != VAR_UNKNOWN)
        noref = (int)tv_get_bool_chk(&argvars[1], NULL);
      if (noref < 0 || noref > 1)
!       emsg(_(e_invarg));
      else
      {
        copyID = get_copyID();
--- 1982,1988 ----
      if (argvars[1].v_type != VAR_UNKNOWN)
        noref = (int)tv_get_bool_chk(&argvars[1], NULL);
      if (noref < 0 || noref > 1)
!       semsg(_(e_using_number_as_bool_nr), noref);
      else
      {
        copyID = get_copyID();
***************
*** 8193,8199 ****
      if (argvars[1].v_type != VAR_UNKNOWN)
        skipcc = (int)tv_get_bool(&argvars[1]);
      if (skipcc < 0 || skipcc > 1)
!       emsg(_(e_invarg));
      else
      {
        func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
--- 8193,8199 ----
      if (argvars[1].v_type != VAR_UNKNOWN)
        skipcc = (int)tv_get_bool(&argvars[1]);
      if (skipcc < 0 || skipcc > 1)
!       semsg(_(e_using_number_as_bool_nr), skipcc);
      else
      {
        func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
*** ../vim-8.2.1750/src/testdir/test_search.vim 2020-09-04 21:18:40.488161918 
+0200
--- src/testdir/test_search.vim 2020-09-26 22:19:02.850153256 +0200
***************
*** 290,295 ****
--- 290,298 ----
    new
    call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
  
+   " should not give an error for using "42"
+   call assert_equal(0, searchpair('a', 'b', 'c', '', 42))
+ 
    4
    call assert_equal(3, searchpair('\[', '', ']', 'bW'))
    call assert_equal([0, 3, 2, 0], getpos('.'))
*** ../vim-8.2.1750/src/testdir/test_terminal2.vim      2020-09-06 
21:12:56.621232486 +0200
--- src/testdir/test_terminal2.vim      2020-09-26 22:32:15.848623040 +0200
***************
*** 560,567 ****
      endif
    endif
  
!   call assert_fails('call term_gettty(buf, 2)', 'E1023:')
!   call assert_fails('call term_gettty(buf, -1)', 'E1023:')
  
    call assert_equal('', term_gettty(buf + 1))
  
--- 560,567 ----
      endif
    endif
  
!   call assert_fails('call term_gettty(buf, 2)', 'E475:')
!   call assert_fails('call term_gettty(buf, -1)', 'E475:')
  
    call assert_equal('', term_gettty(buf + 1))
  
*** ../vim-8.2.1750/src/version.c       2020-09-26 22:02:38.139641102 +0200
--- src/version.c       2020-09-26 22:34:42.648314469 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1751,
  /**/

-- 
If someone questions your market projections, simply point out that your
target market is "People who are nuts" and "People who will buy any damn
thing".  Nobody is going to tell you there aren't enough of those people
to go around.
                                (Scott Adams - The Dilbert principle)

 /// 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/202009262040.08QKe8Jq872722%40masaka.moolenaar.net.

Raspunde prin e-mail lui