diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-05 16:01:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-05 16:01:56 +0200 |
commit | 9978d473e32cee928d6f901a5eb9a297a2970132 (patch) | |
tree | 66b08d96bc91f73175b739a033c8d7b5e719a3ee | |
parent | 05a5551a86e013e35d1dfa10fd0d811c587f9c88 (diff) | |
download | vim-git-9978d473e32cee928d6f901a5eb9a297a2970132.tar.gz |
patch 8.2.1132: Vim9: return type of repeat() is not specific enoughv8.2.1132
Problem: Vim9: return type of repeat() is not specific enough.
Solution: Return the type of the first argument. (closes #6395)
-rw-r--r-- | src/evalfunc.c | 4 | ||||
-rw-r--r-- | src/testdir/test_vim9_func.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 8d81f1512..2cdf186be 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -815,10 +815,10 @@ static funcentry_T global_functions[] = {"remote_peek", 1, 2, FEARG_1, ret_number, f_remote_peek}, {"remote_read", 1, 2, FEARG_1, ret_string, f_remote_read}, {"remote_send", 2, 3, FEARG_1, ret_string, f_remote_send}, - {"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver}, + {"remote_startserver", 1, 1, FEARG_1, ret_void, f_remote_startserver}, {"remove", 2, 3, FEARG_1, ret_any, f_remove}, {"rename", 2, 2, FEARG_1, ret_number, f_rename}, - {"repeat", 2, 2, FEARG_1, ret_any, f_repeat}, + {"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)}, diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 583a23228..e8d712f0a 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -596,6 +596,14 @@ def Test_func_type() assert_equal(13, funcResult) enddef +def Test_repeat_return_type() + let res = 0 + for n in repeat([1], 3) + res += n + endfor + assert_equal(3, res) +enddef + def Test_func_type_part() let RefVoid: func: void RefVoid = FuncNoArgNoRet diff --git a/src/version.c b/src/version.c index 8f85bb7bf..ed3f34ad4 100644 --- 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 */ /**/ + 1132, +/**/ 1131, /**/ 1130, |