diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-05 20:16:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-05 20:16:57 +0200 |
commit | a48f786787e8e070c1a611146fd1f0f7e141e60a (patch) | |
tree | adbdea1b2d742909ef6f1bd3672846d393ef8720 | |
parent | 7918238528090cd019dc19613dbe76923ac9a1d7 (diff) |
patch 8.2.1610: Vim9: cannot pass "true" to list2str() and str2list()v8.2.1610
Problem: Vim9: cannot pass "true" to list2str() and str2list().
Solution: Use tv_get_bool_chk(). (closes #6877)
-rw-r--r-- | src/evalfunc.c | 2 | ||||
-rw-r--r-- | src/list.c | 2 | ||||
-rw-r--r-- | src/testdir/test_vim9_func.vim | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 9e384da494..b4e4220412 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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]); diff --git a/src/list.c b/src/list.c index e0c8c2e17d..fa9843ac88 100644 --- a/src/list.c +++ b/src/list.c @@ -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); diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index a80767ad2a..84fc7c9557 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -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 diff --git a/src/version.c b/src/version.c index 9216408c01..a8cf1680a3 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1610, +/**/ 1609, /**/ 1608, |