patch 8.2.2338: Vim9: no error if using job_info() result wrongly
Problem: Vim9: no error if using job_info() result wrongly.
Solution: Adjust return type on number of arguments. (closes #7667)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 0d17b9e..65cb59f 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -472,6 +472,13 @@
return &t_dict_any;
}
static type_T *
+ret_job_info(int argcount, type_T **argtypes UNUSED)
+{
+ if (argcount == 0)
+ return &t_list_job;
+ return &t_dict_any;
+}
+ static type_T *
ret_dict_number(int argcount UNUSED, type_T **argtypes UNUSED)
{
return &t_dict_number;
@@ -1100,7 +1107,7 @@
{"job_getchannel", 1, 1, FEARG_1, NULL,
ret_channel, JOB_FUNC(f_job_getchannel)},
{"job_info", 0, 1, FEARG_1, NULL,
- ret_dict_any, JOB_FUNC(f_job_info)},
+ ret_job_info, JOB_FUNC(f_job_info)},
{"job_setoptions", 2, 2, FEARG_1, NULL,
ret_void, JOB_FUNC(f_job_setoptions)},
{"job_start", 1, 2, FEARG_1, NULL,