mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
GH-365: improve un-indexable type error message
This commit is contained in:
parent
aced89ac9e
commit
58d55d0f95
3 changed files with 11 additions and 2 deletions
|
@ -2917,7 +2917,12 @@ IndexExpr::IndexExpr(Expr* arg_op1, ListExpr* arg_op2, bool is_slice)
|
|||
|
||||
int match_type = op1->Type()->MatchesIndex(arg_op2);
|
||||
if ( match_type == DOES_NOT_MATCH_INDEX )
|
||||
SetError("not an index type");
|
||||
{
|
||||
std::string error_msg =
|
||||
fmt("expression with type '%s' is not a type that can be indexed",
|
||||
type_name(op1->Type()->Tag()));
|
||||
SetError(error_msg.data());
|
||||
}
|
||||
|
||||
else if ( ! op1->Type()->YieldType() )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue