summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-31 22:03:59 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-31 22:03:59 +0200
commit1780f08ba42837b6d4a5f0451117a79b2d49974a (patch)
tree344aba2fa3ce158403fac40e1a02a381b09b9d8b /src/evalfunc.c
parent335c8c7b206df776b59fb63a1c7f91c8b1425398 (diff)
patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is numberv8.2.3261
Problem: Vim9: when compiling repeat(123, N) return type is number. Solution: Make return type a string. (closes #8664)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 87b498a496..23a39aa4f2 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -931,6 +931,13 @@ ret_first_arg(int argcount, type_T **argtypes)
return argtypes[0];
return &t_void;
}
+ static type_T *
+ret_repeat(int argcount UNUSED, type_T **argtypes)
+{
+ if (argtypes[0] == &t_number)
+ return &t_string;
+ return argtypes[0];
+}
// for map(): returns first argument but item type may differ
static type_T *
ret_first_cont(int argcount UNUSED, type_T **argtypes)
@@ -1813,7 +1820,7 @@ static funcentry_T global_functions[] =
{"rename", 2, 2, FEARG_1, arg2_string,
ret_number_bool, f_rename},
{"repeat", 2, 2, FEARG_1, arg2_repeat,
- ret_first_arg, f_repeat},
+ ret_repeat, f_repeat},
{"resolve", 1, 1, FEARG_1, arg1_string,
ret_string, f_resolve},
{"reverse", 1, 1, FEARG_1, arg1_list_or_blob,