Patch 8.2.1610
Problem:    Vim9: cannot pass "true" to list2str() and str2list().
Solution:   Use tv_get_bool_chk(). (closes #6877)
Files:      src/evalfunc.c, src/list.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1609/src/evalfunc.c      2020-09-05 18:45:26.047602885 +0200
--- src/evalfunc.c      2020-09-05 20:16:10.150507702 +0200
***************
*** 7982,7988 ****
        return;
  
      if (argvars[1].v_type != VAR_UNKNOWN)
!       utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
  
      p = tv_get_string(&argvars[0]);
  
--- 7982,7988 ----
        return;
  
      if (argvars[1].v_type != VAR_UNKNOWN)
!       utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
  
      p = tv_get_string(&argvars[0]);
  
*** ../vim-8.2.1609/src/list.c  2020-09-02 21:30:04.667134268 +0200
--- src/list.c  2020-09-05 20:16:26.058472877 +0200
***************
*** 1397,1403 ****
        return;  // empty list results in empty string
  
      if (argvars[1].v_type != VAR_UNKNOWN)
!       utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
  
      CHECK_LIST_MATERIALIZE(l);
      ga_init2(&ga, 1, 80);
--- 1397,1403 ----
        return;  // empty list results in empty string
  
      if (argvars[1].v_type != VAR_UNKNOWN)
!       utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
  
      CHECK_LIST_MATERIALIZE(l);
      ga_init2(&ga, 1, 80);
*** ../vim-8.2.1609/src/testdir/test_vim9_func.vim      2020-09-05 
18:48:53.843184261 +0200
--- src/testdir/test_vim9_func.vim      2020-09-05 20:15:45.042562498 +0200
***************
*** 1522,1527 ****
--- 1522,1534 ----
    assert_equal(1, has('eval', true))
  enddef
  
+ def Test_list2str_str2list_utf8()
+   let s = "\u3042\u3044"
+   let l = [0x3042, 0x3044]
+   assert_equal(l, str2list(s, true))
+   assert_equal(s, list2str(l, true))
+ enddef
+ 
  def Fibonacci(n: number): number
    if n < 2
      return n
*** ../vim-8.2.1609/src/version.c       2020-09-05 20:06:29.751863835 +0200
--- src/version.c       2020-09-05 20:14:47.006688300 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1610,
  /**/

-- 
5 out of 4 people have trouble with fractions.

 /// 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/202009051818.085IIZD4676050%40masaka.moolenaar.net.

Raspunde prin e-mail lui