# HG changeset patch # User Bram Moolenaar # Date 1593976504 -7200 # Node ID 34667dc9207b9d299c92771b9db9e5d47b9331d2 # Parent dfaeb84dfb9c3f51fa1f693cb41ad6d7cdaad85d patch 8.2.1144: Vim9: return type of reverse() is any Commit: https://github.com/vim/vim/commit/67627355accff4af4f2a7e727c77ea8df675636e Author: Bram Moolenaar Date: Sun Jul 5 21:10:24 2020 +0200 patch 8.2.1144: Vim9: return type of reverse() is any Problem: Vim9: return type of reverse() is any. Solution: Use the type of the first argument. diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -842,7 +842,7 @@ static funcentry_T global_functions[] = {"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}, + {"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 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 @@ -927,6 +927,15 @@ def Test_insert_return_type() 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 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 */ /**/ + 1144, +/**/ 1143, /**/ 1142,