To: vim_dev@googlegroups.com Subject: Patch 8.2.1144 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1144 Problem: Vim9: return type of reverse() is any. Solution: Use the type of the first argument. Files: src/evalfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1143/src/evalfunc.c 2020-07-05 20:55:25.989139371 +0200 --- src/evalfunc.c 2020-07-05 20:58:00.628515650 +0200 *************** *** 842,848 **** {"rename", 2, 2, FEARG_1, ret_number, f_rename}, {"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat}, {"resolve", 1, 1, FEARG_1, ret_string, f_resolve}, ! {"reverse", 1, 1, FEARG_1, ret_any, f_reverse}, {"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)}, {"rubyeval", 1, 1, FEARG_1, ret_any, #ifdef FEAT_RUBY --- 842,848 ---- {"rename", 2, 2, FEARG_1, ret_number, f_rename}, {"repeat", 2, 2, FEARG_1, ret_first_arg, f_repeat}, {"resolve", 1, 1, FEARG_1, ret_string, f_resolve}, ! {"reverse", 1, 1, FEARG_1, ret_first_arg, f_reverse}, {"round", 1, 1, FEARG_1, ret_float, FLOAT_FUNC(f_round)}, {"rubyeval", 1, 1, FEARG_1, ret_any, #ifdef FEAT_RUBY *** ../vim-8.2.1143/src/testdir/test_vim9_func.vim 2020-07-05 20:55:25.989139371 +0200 --- src/testdir/test_vim9_func.vim 2020-07-05 20:58:30.884394917 +0200 *************** *** 927,932 **** --- 927,941 ---- assert_equal(6, res) enddef + def Test_reverse_return_type() + let l = reverse([1, 2, 3]) + let res = 0 + for n in l + res += n + endfor + assert_equal(6, res) + enddef + def Test_remove_return_type() let l = remove(#{one: [1, 2], two: [3, 4]}, 'one') let res = 0 *** ../vim-8.2.1143/src/version.c 2020-07-05 20:55:25.989139371 +0200 --- src/version.c 2020-07-05 20:59:18.416205991 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1144, /**/ -- Managers are like cats in a litter box. They instinctively shuffle things around to conceal what they've done. (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 ///