To: vim_dev@googlegroups.com Subject: Patch 8.2.3911 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3911 Problem: Vim9: type check for filter() does not accept unknown. Solution: Also accept unknown for the return type. (closes #9413) Files: src/evalfunc.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.3910/src/evalfunc.c 2021-12-26 17:18:10.333927753 +0000 --- src/evalfunc.c 2021-12-27 12:20:10.795048673 +0000 *************** *** 494,499 **** --- 494,500 ---- if (type->tt_type == VAR_FUNC && !(type->tt_member->tt_type == VAR_BOOL || type->tt_member->tt_type == VAR_NUMBER + || type->tt_member->tt_type == VAR_UNKNOWN || type->tt_member->tt_type == VAR_ANY)) { arg_type_mismatch(&t_func_bool, type, context->arg_idx + 1); *** ../vim-8.2.3910/src/testdir/test_vim9_builtin.vim 2021-12-27 11:54:30.709518535 +0000 --- src/testdir/test_vim9_builtin.vim 2021-12-27 12:28:29.238635070 +0000 *************** *** 1253,1258 **** --- 1253,1264 ---- assert_equal([], filter([1, 2, 3], '0')) assert_equal([1, 2, 3], filter([1, 2, 3], '1')) assert_equal({b: 20}, filter({a: 10, b: 20}, 'v:val == 20')) + + def GetFiltered(): list + var Odd: func = (_, v) => v % 2 + return range(3)->filter(Odd) + enddef + assert_equal([1], GetFiltered()) enddef def Test_filter_wrong_dict_key_type() *** ../vim-8.2.3910/src/version.c 2021-12-27 11:54:30.709518535 +0000 --- src/version.c 2021-12-27 12:21:57.238995106 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3911, /**/ -- hundred-and-one symptoms of being an internet addict: 119. You are reading a book and look for the scroll bar to get to the next page. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///