patch 8.2.3186: Vim9: not all failures for import tested
Problem: Vim9: not all failures for import tested
Solution: Test more import failures
diff --git a/src/evalvars.c b/src/evalvars.c
index dcf1058..d0bbff7 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -3250,6 +3250,7 @@
{
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
svar_T *sv;
+ where_T where;
// imported variable from another script
if ((flags & ASSIGN_NO_DECL) == 0)
@@ -3257,10 +3258,16 @@
semsg(_(e_redefining_imported_item_str), name);
goto failed;
}
- sv = ((svar_T *)si->sn_var_vals.ga_data)
- + import->imp_var_vals_idx;
- // TODO: check the type
- // TODO: check for const and locked
+ sv = ((svar_T *)si->sn_var_vals.ga_data) + import->imp_var_vals_idx;
+
+ where.wt_index = 0;
+ where.wt_variable = TRUE;
+ if (check_typval_type(sv->sv_type, tv, where) == FAIL
+ || value_check_lock(sv->sv_tv->v_lock, name, FALSE))
+ {
+ goto failed;
+ }
+
dest_tv = sv->sv_tv;
clear_tv(dest_tv);
}