Skip to content

Commit

Permalink
feat: Improve the error message for wrong index type
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Nov 6, 2024
1 parent 177df6a commit 49ada00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/gitql-parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3210,10 +3210,11 @@ fn parse_index_or_slice_expression(
let rhs_expected_types = lhs_type.can_perform_index_op_with();
if !rhs_expected_types.contains(&index_type) {
return Err(Diagnostic::error(&format!(
"Operator Index `[]` can't be performed between on {} with index `{}`",
"Operator Index `[ ]` can't be performed on type `{}` with index type `{}`",
lhs_type.literal(),
index_type.literal(),
))
.add_help("Check the Type documentation to know the correct available Index type")
.with_location(operator.location)
.as_boxed());
}
Expand Down

0 comments on commit 49ada00

Please sign in to comment.