patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number
Problem: Vim9: when compiling repeat(123, N) return type is number.
Solution: Make return type a string. (closes #8664)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 87b498a..23a39aa 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -931,6 +931,13 @@
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 @@
{"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,