To: vim_dev@googlegroups.com Subject: Patch 8.2.1571 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1571 Problem: Vim9: count() third argument cannot be "true". Solution: use tv_get_bool_chk(). (closes #6818) Files: src/typval.c, src/list.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1570/src/typval.c 2020-09-01 23:05:57.812835372 +0200 --- src/typval.c 2020-09-02 21:24:58.416105774 +0200 *************** *** 283,289 **** tv_get_bool_chk(typval_T *varp, int *denote) { return tv_get_bool_or_number_chk(varp, denote, TRUE); - } #ifdef FEAT_FLOAT --- 283,288 ---- *** ../vim-8.2.1570/src/list.c 2020-08-21 22:36:43.662719906 +0200 --- src/list.c 2020-09-02 21:24:48.852136985 +0200 *************** *** 2167,2173 **** int error = FALSE; if (argvars[2].v_type != VAR_UNKNOWN) ! ic = (int)tv_get_number_chk(&argvars[2], &error); if (argvars[0].v_type == VAR_STRING) { --- 2167,2173 ---- int error = FALSE; if (argvars[2].v_type != VAR_UNKNOWN) ! ic = (int)tv_get_bool_chk(&argvars[2], &error); if (argvars[0].v_type == VAR_STRING) { *** ../vim-8.2.1570/src/testdir/test_vim9_func.vim 2020-09-02 21:02:32.304208489 +0200 --- src/testdir/test_vim9_func.vim 2020-09-02 21:26:56.983723579 +0200 *************** *** 1492,1497 **** --- 1492,1502 ---- endif enddef + def Test_count() + assert_equal(3, count('ABC ABC ABC', 'b', true)) + assert_equal(0, count('ABC ABC ABC', 'b', false)) + enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef *** ../vim-8.2.1570/src/version.c 2020-09-02 21:21:30.964799806 +0200 --- src/version.c 2020-09-02 21:28:03.967511309 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1571, /**/ -- This is the polymorph virus! Follow these instructions carefully: 1. Send this message to everybody you know. 2. Format your harddisk. Thank you for your cooperation in spreading the most powerful virus ever! /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///