return &t_any;
}
+ static type_T *
+ret_getreg(int argcount, type_T **argtypes UNUSED)
+{
+ // Assume that if the third argument is passed it's non-zero
+ if (argcount == 3)
+ return &t_list_string;
+ return &t_string;
+}
+
static type_T *ret_f_function(int argcount, type_T **argtypes);
/*
{"getpid", 0, 0, 0, ret_number, f_getpid},
{"getpos", 1, 1, FEARG_1, ret_list_number, f_getpos},
{"getqflist", 0, 1, 0, ret_list_or_dict_0, f_getqflist},
- {"getreg", 0, 3, FEARG_1, ret_string, f_getreg},
+ {"getreg", 0, 3, FEARG_1, ret_getreg, f_getreg},
{"getreginfo", 0, 1, FEARG_1, ret_dict_any, f_getreginfo},
{"getregtype", 0, 1, FEARG_1, ret_string, f_getregtype},
{"gettabinfo", 0, 1, FEARG_1, ret_list_dict_any, f_gettabinfo},
assert_equal(6, res)
enddef
+def Test_getreg_return_type()
+ let s1: string = getreg('"')
+ let s2: string = getreg('"', 1)
+ let s3: list<string> = getreg('"', 1, 1)
+enddef
+
def Wrong_dict_key_type(items: list<number>): list<number>
return filter(items, {_, val -> get({val: 1}, 'x')})
enddef