]> granicus.if.org Git - vim/commitdiff
patch 8.2.1610: Vim9: cannot pass "true" to list2str() and str2list() v8.2.1610
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 18:16:57 +0000 (20:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 18:16:57 +0000 (20:16 +0200)
Problem:    Vim9: cannot pass "true" to list2str() and str2list().
Solution:   Use tv_get_bool_chk(). (closes #6877)

src/evalfunc.c
src/list.c
src/testdir/test_vim9_func.vim
src/version.c

index 9e384da4944dc076eccfa9856c898644d005d72e..b4e4220412ebc3ae322a447561c97f3410840c17 100644 (file)
@@ -7982,7 +7982,7 @@ f_str2list(typval_T *argvars, typval_T *rettv)
        return;
 
     if (argvars[1].v_type != VAR_UNKNOWN)
-       utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
+       utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
 
     p = tv_get_string(&argvars[0]);
 
index e0c8c2e17d254900955f8ab96d175591423345bb..fa9843ac88c304e4d429ce2606d491225fe44bb9 100644 (file)
@@ -1397,7 +1397,7 @@ f_list2str(typval_T *argvars, typval_T *rettv)
        return;  // empty list results in empty string
 
     if (argvars[1].v_type != VAR_UNKNOWN)
-       utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
+       utf8 = (int)tv_get_bool_chk(&argvars[1], NULL);
 
     CHECK_LIST_MATERIALIZE(l);
     ga_init2(&ga, 1, 80);
index a80767ad2aa9788a6add3c22f176b3a36426597b..84fc7c9557f90d4b01b95026b743b85fa212da04 100644 (file)
@@ -1522,6 +1522,13 @@ def Test_has()
   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
index 9216408c0147e699b9d9c1ae042533b5e8c0a22a..a8cf1680a372f32dd2a246e2883d496ad0262d90 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1610,
 /**/
     1609,
 /**/