# HG changeset patch # User Bram Moolenaar # Date 1599330604 -7200 # Node ID 978f91276449027d981141763bf47a8bc6ab75be # Parent 4103523f56e4ce2b1ff7f80628d6293d142043a2 patch 8.2.1611: Vim9: cannot pass "true" to nr2char() Commit: https://github.com/vim/vim/commit/ed6a430fae72c077ec106c9620379b69cfec3035 Author: Bram Moolenaar 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) diff --git a/src/evalfunc.c b/src/evalfunc.c --- 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 diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- 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 diff --git a/src/version.c b/src/version.c --- 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,