patch 8.2.3852: Vim9: not enough tests
Problem: Vim9: not enough tests.
Solution: Also run existing tests for Vim9 script. Make errors more
consistent.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index d6fc6d8..ff96b10 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3043,7 +3043,25 @@
}
else
{
- emsg(_(e_string_list_dict_or_blob_required));
+ switch (vartype)
+ {
+ case VAR_FUNC:
+ case VAR_PARTIAL:
+ emsg(_(e_cannot_index_a_funcref));
+ break;
+ case VAR_BOOL:
+ case VAR_SPECIAL:
+ case VAR_JOB:
+ case VAR_CHANNEL:
+ case VAR_INSTR:
+ case VAR_UNKNOWN:
+ case VAR_ANY:
+ case VAR_VOID:
+ emsg(_(e_cannot_index_special_variable));
+ break;
+ default:
+ emsg(_(e_string_list_dict_or_blob_required));
+ }
return FAIL;
}
return OK;