patch 8.2.2501: not always clear where an error is reported

Problem:    Not always clear where an error is reported.
Solution:   Add the where_T structure and pass it around. (closes #7796)
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index 07b11b2..03630c4 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -25,7 +25,7 @@
 int eval_foldexpr(char_u *arg, int *cp);
 char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags);
 void clear_lval(lval_T *lp);
-void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, int flags, char_u *op);
+void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, int flags, char_u *op, int var_idx);
 void *eval_for_line(char_u *arg, int *errp, exarg_T *eap, evalarg_T *evalarg);
 void skip_for_lines(void *fi_void, evalarg_T *evalarg);
 int next_for_item(void *fi_void, char_u *arg);
diff --git a/src/proto/evalvars.pro b/src/proto/evalvars.pro
index 0861a88..ce160d7 100644
--- a/src/proto/evalvars.pro
+++ b/src/proto/evalvars.pro
@@ -70,7 +70,7 @@
 void vars_clear_ext(hashtab_T *ht, int free_val);
 void delete_var(hashtab_T *ht, hashitem_T *hi);
 void set_var(char_u *name, typval_T *tv, int copy);
-void set_var_const(char_u *name, type_T *type, typval_T *tv_arg, int copy, int flags);
+void set_var_const(char_u *name, type_T *type, typval_T *tv_arg, int copy, int flags, int var_idx);
 int var_check_permission(dictitem_T *di, char_u *name);
 int var_check_ro(int flags, char_u *name, int use_gettext);
 int var_check_lock(int flags, char_u *name, int use_gettext);
diff --git a/src/proto/vim9script.pro b/src/proto/vim9script.pro
index 2a63b8b..c649351 100644
--- a/src/proto/vim9script.pro
+++ b/src/proto/vim9script.pro
@@ -14,5 +14,5 @@
 void hide_script_var(scriptitem_T *si, int idx, int func_defined);
 void free_all_script_vars(scriptitem_T *si);
 svar_T *find_typval_in_script(typval_T *dest);
-int check_script_var_type(typval_T *dest, typval_T *value, char_u *name);
+int check_script_var_type(typval_T *dest, typval_T *value, char_u *name, where_T where);
 /* vim: set ft=c : */
diff --git a/src/proto/vim9type.pro b/src/proto/vim9type.pro
index f7b472c..35da1fe 100644
--- a/src/proto/vim9type.pro
+++ b/src/proto/vim9type.pro
@@ -11,10 +11,12 @@
 int need_convert_to_bool(type_T *type, typval_T *tv);
 type_T *typval2type(typval_T *tv, garray_T *type_gap);
 type_T *typval2type_vimvar(typval_T *tv, garray_T *type_gap);
-int check_typval_type(type_T *expected, typval_T *actual_tv, int argidx);
+int check_typval_arg_type(type_T *expected, typval_T *actual_tv, int arg_idx);
+int check_typval_type(type_T *expected, typval_T *actual_tv, where_T where);
 void type_mismatch(type_T *expected, type_T *actual);
-void arg_type_mismatch(type_T *expected, type_T *actual, int argidx);
-int check_type(type_T *expected, type_T *actual, int give_msg, int argidx);
+void arg_type_mismatch(type_T *expected, type_T *actual, int arg_idx);
+void type_mismatch_where(type_T *expected, type_T *actual, where_T where);
+int check_type(type_T *expected, type_T *actual, int give_msg, where_T where);
 int check_argument_types(type_T *type, typval_T *argvars, int argcount, char_u *name);
 char_u *skip_type(char_u *start, int optional);
 type_T *parse_type(char_u **arg, garray_T *type_gap, int give_error);