To: vim_dev@googlegroups.com Subject: Patch 8.2.1142 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1142 Problem: Vim9: return type of insert() is any. Solution: Use type of the first argument. Files: src/evalfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1141/src/evalfunc.c 2020-07-05 20:16:38.042444749 +0200 --- src/evalfunc.c 2020-07-05 20:44:06.836125124 +0200 *************** *** 667,673 **** {"inputrestore", 0, 0, 0, ret_number, f_inputrestore}, {"inputsave", 0, 0, 0, ret_number, f_inputsave}, {"inputsecret", 1, 2, FEARG_1, ret_string, f_inputsecret}, ! {"insert", 2, 3, FEARG_1, ret_any, f_insert}, {"interrupt", 0, 0, 0, ret_void, f_interrupt}, {"invert", 1, 1, FEARG_1, ret_number, f_invert}, {"isdirectory", 1, 1, FEARG_1, ret_number, f_isdirectory}, --- 667,673 ---- {"inputrestore", 0, 0, 0, ret_number, f_inputrestore}, {"inputsave", 0, 0, 0, ret_number, f_inputsave}, {"inputsecret", 1, 2, FEARG_1, ret_string, f_inputsecret}, ! {"insert", 2, 3, FEARG_1, ret_first_arg, f_insert}, {"interrupt", 0, 0, 0, ret_void, f_interrupt}, {"invert", 1, 1, FEARG_1, ret_number, f_invert}, {"isdirectory", 1, 1, FEARG_1, ret_number, f_isdirectory}, *** ../vim-8.2.1141/src/testdir/test_vim9_func.vim 2020-07-05 20:16:38.046444737 +0200 --- src/testdir/test_vim9_func.vim 2020-07-05 20:45:24.143752915 +0200 *************** *** 918,923 **** --- 918,932 ---- assert_equal(6, res) enddef + def Test_insert_return_type() + let l = insert([2, 1], 3) + let res = 0 + for n in l + res += n + endfor + assert_equal(6, res) + enddef + def Test_filter_return_type() let l = filter([1, 2, 3], {-> 1}) let res = 0 *** ../vim-8.2.1141/src/version.c 2020-07-05 20:16:38.046444737 +0200 --- src/version.c 2020-07-05 20:45:56.971598347 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1142, /**/ -- Team-building exercises come in many forms but they all trace their roots back to the prison system. In your typical team-building exercise the employees are subjected to a variety of unpleasant situations until they become either a cohesive team or a ring of car jackers. (Scott Adams - The Dilbert principle) /// 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 ///