changeset 22123:978f91276449 v8.2.1611

patch 8.2.1611: Vim9: cannot pass "true" to nr2char() Commit: https://github.com/vim/vim/commit/ed6a430fae72c077ec106c9620379b69cfec3035 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 5 20:29:41 2020 +0200 patch 8.2.1611: Vim9: cannot pass "true" to nr2char() Problem: Vim9: cannot pass "true" to nr2char(). Solution: use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6878)
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Sep 2020 20:30:04 +0200
parents 4103523f56e4
children 895f24234802
files src/evalfunc.c src/testdir/test_vim9_func.vim src/version.c
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5874,7 +5874,7 @@ f_nr2char(typval_T *argvars, typval_T *r
 	int	utf8 = 0;
 
 	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);
 	if (utf8)
 	    buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL;
 	else
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1529,6 +1529,10 @@ def Test_list2str_str2list_utf8()
   assert_equal(s, list2str(l, true))
 enddef
 
+def Test_nr2char()
+  assert_equal('a', nr2char(97, true))
+enddef
+
 def Fibonacci(n: number): number
   if n < 2
     return n
--- 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 */
 /**/
+    1611,
+/**/
     1610,
 /**/
     1609,