comparison src/evalfunc.c @ 25449:5dce28f92d04 v8.2.3261

patch 8.2.3261: Vim9: when compiling repeat(123, N) return type is number Commit: https://github.com/vim/vim/commit/1780f08ba42837b6d4a5f0451117a79b2d49974a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 31 22:03:59 2021 +0200 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 https://github.com/vim/vim/issues/8664)
author Bram Moolenaar <Bram@vim.org>
date Sat, 31 Jul 2021 22:15:02 +0200
parents 634aed775408
children b8a6a0007dc3
comparison
equal deleted inserted replaced
25448:cde84529a0a6 25449:5dce28f92d04
928 ret_first_arg(int argcount, type_T **argtypes) 928 ret_first_arg(int argcount, type_T **argtypes)
929 { 929 {
930 if (argcount > 0) 930 if (argcount > 0)
931 return argtypes[0]; 931 return argtypes[0];
932 return &t_void; 932 return &t_void;
933 }
934 static type_T *
935 ret_repeat(int argcount UNUSED, type_T **argtypes)
936 {
937 if (argtypes[0] == &t_number)
938 return &t_string;
939 return argtypes[0];
933 } 940 }
934 // for map(): returns first argument but item type may differ 941 // for map(): returns first argument but item type may differ
935 static type_T * 942 static type_T *
936 ret_first_cont(int argcount UNUSED, type_T **argtypes) 943 ret_first_cont(int argcount UNUSED, type_T **argtypes)
937 { 944 {
1811 {"remove", 2, 3, FEARG_1, arg23_remove, 1818 {"remove", 2, 3, FEARG_1, arg23_remove,
1812 ret_remove, f_remove}, 1819 ret_remove, f_remove},
1813 {"rename", 2, 2, FEARG_1, arg2_string, 1820 {"rename", 2, 2, FEARG_1, arg2_string,
1814 ret_number_bool, f_rename}, 1821 ret_number_bool, f_rename},
1815 {"repeat", 2, 2, FEARG_1, arg2_repeat, 1822 {"repeat", 2, 2, FEARG_1, arg2_repeat,
1816 ret_first_arg, f_repeat}, 1823 ret_repeat, f_repeat},
1817 {"resolve", 1, 1, FEARG_1, arg1_string, 1824 {"resolve", 1, 1, FEARG_1, arg1_string,
1818 ret_string, f_resolve}, 1825 ret_string, f_resolve},
1819 {"reverse", 1, 1, FEARG_1, arg1_list_or_blob, 1826 {"reverse", 1, 1, FEARG_1, arg1_list_or_blob,
1820 ret_first_arg, f_reverse}, 1827 ret_first_arg, f_reverse},
1821 {"round", 1, 1, FEARG_1, arg1_float_or_nr, 1828 {"round", 1, 1, FEARG_1, arg1_float_or_nr,