Skip to content

Commit

Permalink
fix: Show types in error message in same order as in source code (#2353)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Aug 17, 2023
1 parent 8b99061 commit feebee4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions crates/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ impl<'interner> TypeChecker<'interner> {
Ok(Bool)
} else {
Err(TypeCheckError::TypeMismatchWithSource {
rhs: lhs_type.clone(),
lhs: rhs_type.clone(),
lhs: lhs_type.clone(),
rhs: rhs_type.clone(),
span,
source: Source::Binary,
})
Expand Down Expand Up @@ -732,15 +732,15 @@ impl<'interner> TypeChecker<'interner> {
if matches!(op.kind, Equal | NotEqual) =>
{
self.unify(x_type, y_type, || TypeCheckError::TypeMismatchWithSource {
rhs: lhs_type.clone(),
lhs: rhs_type.clone(),
lhs: lhs_type.clone(),
rhs: rhs_type.clone(),
source: Source::ArrayElements,
span: op.location.span,
});

self.unify(x_size, y_size, || TypeCheckError::TypeMismatchWithSource {
rhs: lhs_type.clone(),
lhs: rhs_type.clone(),
lhs: lhs_type.clone(),
rhs: rhs_type.clone(),
source: Source::ArrayLen,
span: op.location.span,
});
Expand All @@ -752,8 +752,8 @@ impl<'interner> TypeChecker<'interner> {
return Ok(Bool);
}
Err(TypeCheckError::TypeMismatchWithSource {
rhs: lhs.clone(),
lhs: rhs.clone(),
lhs: lhs.clone(),
rhs: rhs.clone(),
source: Source::Comparison,
span,
})
Expand All @@ -769,8 +769,8 @@ impl<'interner> TypeChecker<'interner> {
Ok(Bool)
}
(lhs, rhs) => Err(TypeCheckError::TypeMismatchWithSource {
rhs: lhs.clone(),
lhs: rhs.clone(),
lhs: lhs.clone(),
rhs: rhs.clone(),
source: Source::Comparison,
span,
}),
Expand Down

0 comments on commit feebee4

Please sign in to comment.