patch 8.2.3200: Vim9: hard to guess where a type error is given
Problem: Vim9: hard to guess where a type error is given.
Solution: Add the function name where possible. (closes #8608)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 6cc1fc7..33ad788 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -730,15 +730,18 @@
int idx;
int did_emsg_before = did_emsg;
ectx_T *prev_ectx = current_ectx;
+ char *save_func_name = ectx->ec_where.wt_func_name;
if (call_prepare(argcount, argvars, ectx) == FAIL)
return FAIL;
+ ectx->ec_where.wt_func_name = internal_func_name(func_idx);
// Call the builtin function. Set "current_ectx" so that when it
// recursively invokes call_def_function() a closure context can be set.
current_ectx = ectx;
call_internal_func_by_idx(func_idx, argvars, STACK_TV_BOT(-1));
current_ectx = prev_ectx;
+ ectx->ec_where.wt_func_name = save_func_name;
// Clear the arguments.
for (idx = 0; idx < argcount; ++idx)
@@ -907,7 +910,7 @@
else if (ufunc->uf_va_type != NULL)
type = ufunc->uf_va_type->tt_member;
if (type != NULL && check_typval_arg_type(type,
- &argv[i], i + 1) == FAIL)
+ &argv[i], NULL, i + 1) == FAIL)
return FAIL;
}
}
@@ -4535,7 +4538,8 @@
{
if (ufunc->uf_arg_types != NULL && idx < ufunc->uf_args.ga_len
&& check_typval_arg_type(
- ufunc->uf_arg_types[idx], &argv[idx], idx + 1) == FAIL)
+ ufunc->uf_arg_types[idx], &argv[idx],
+ NULL, idx + 1) == FAIL)
goto failed_early;
copy_tv(&argv[idx], STACK_TV_BOT(0));
}
@@ -4567,7 +4571,7 @@
for (idx = 0; idx < vararg_count; ++idx)
{
if (check_typval_arg_type(expected, &li->li_tv,
- argc + idx + 1) == FAIL)
+ NULL, argc + idx + 1) == FAIL)
goto failed_early;
li = li->li_next;
}