Patch 8.2.1701
Problem:    Vim9: sort("i") does not work.
Solution:   Don't try getting a number for a string argument. (closes #6958)
Files:      src/list.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1700/src/list.c  2020-09-16 21:08:23.642361197 +0200
--- src/list.c  2020-09-16 23:22:06.835343624 +0200
***************
*** 1717,1734 ****
            else
            {
                int         error = FALSE;
  
!               i = (long)tv_get_number_chk(&argvars[1], &error);
!               if (error)
!                   goto theend;        // type error; errmsg already given
!               if (i == 1)
!                   info.item_compare_ic = TRUE;
!               else if (argvars[1].v_type != VAR_NUMBER)
!                   info.item_compare_func = tv_get_string(&argvars[1]);
!               else if (i != 0)
                {
!                   emsg(_(e_invarg));
!                   goto theend;
                }
                if (info.item_compare_func != NULL)
                {
--- 1717,1741 ----
            else
            {
                int         error = FALSE;
+               int         nr = 0;
  
!               if (argvars[1].v_type == VAR_NUMBER)
                {
!                   nr = tv_get_number_chk(&argvars[1], &error);
!                   if (error)
!                       goto theend;    // type error; errmsg already given
!                   if (nr == 1)
!                       info.item_compare_ic = TRUE;
!               }
!               if (nr != 1)
!               {
!                   if (argvars[1].v_type != VAR_NUMBER)
!                       info.item_compare_func = tv_get_string(&argvars[1]);
!                   else if (nr != 0)
!                   {
!                       emsg(_(e_invarg));
!                       goto theend;
!                   }
                }
                if (info.item_compare_func != NULL)
                {
*** ../vim-8.2.1700/src/testdir/test_vim9_func.vim      2020-09-16 
17:55:36.537602345 +0200
--- src/testdir/test_vim9_func.vim      2020-09-16 23:10:18.026056574 +0200
***************
*** 1299,1304 ****
--- 1299,1309 ----
    res = [1, 2, 3]->sort()
  enddef
  
+ def Test_sort_argument()
+   let res = ['b', 'a', 'c']->sort('i')
+   res->assert_equal(['a', 'b', 'c'])
+ enddef
+ 
  def Test_getqflist_return_type()
    let l = getqflist()
    l->assert_equal([])
*** ../vim-8.2.1700/src/version.c       2020-09-16 22:29:49.441083728 +0200
--- src/version.c       2020-09-16 23:11:43.629790551 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1701,
  /**/

-- 
This message contains 78% recycled characters.

 /// 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/202009162124.08GLO28p2262742%40masaka.moolenaar.net.

Raspunde prin e-mail lui