Skip to content

Commit

Permalink
Formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Aug 26, 2024
1 parent b1dff48 commit c04a7b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
19 changes: 6 additions & 13 deletions compiler/noirc_frontend/src/hir/comptime/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,18 +538,12 @@ impl<'a> From<&'a InterpreterError> for CustomDiagnostic {
CustomDiagnostic::simple_error(msg, secondary, location.span)
}
InterpreterError::MultipleMatchingImpls { object_type, candidates, location } => {
let mut error = CustomDiagnostic::simple_error(
format!("Multiple trait impls match the object type `{object_type}`"),
"Ambiguous impl".to_string(),
location.span,
);
let message = format!("Multiple trait impls match the object type `{object_type}`");
let secondary = "Ambiguous impl".to_string();
let mut error = CustomDiagnostic::simple_error(message, secondary, location.span);
for (i, candidate) in candidates.iter().enumerate() {
error.add_note(format!("Candidate {}: `{candidate}`", i + 1));
}
error.add_note(
"Try adding a type annotation for the object type before this method call"
.to_string(),
);
error
}
InterpreterError::TypeAnnotationsNeededForMethodCall { location } => {
Expand All @@ -558,10 +552,9 @@ impl<'a> From<&'a InterpreterError> for CustomDiagnostic {
"Type must be known by this point to know which method to call".to_string(),
location.span,
);
error.add_note(
"Try adding a type annotation for the object type before this method call"
.to_string(),
);
let message =
"Try adding a type annotation for the object type before this method call";
error.add_note(message.to_string());
error
}
}
Expand Down
9 changes: 3 additions & 6 deletions compiler/noirc_frontend/src/hir/type_check/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,12 @@ impl<'a> From<&'a TypeCheckError> for Diagnostic {
error
},
TypeCheckError::MultipleMatchingImpls { object_type, candidates, span } => {
let mut error = Diagnostic::simple_error(
format!("Multiple trait impls match the object type `{object_type}`"),
"Ambiguous impl".to_string(),
*span,
);
let message = format!("Multiple trait impls match the object type `{object_type}`");
let secondary = "Ambiguous impl".to_string();
let mut error = Diagnostic::simple_error(message, secondary, *span);
for (i, candidate) in candidates.iter().enumerate() {
error.add_note(format!("Candidate {}: `{candidate}`", i + 1));
}
error.add_note("Try adding a type annotation for the object type before this method call".to_string());
error
},
TypeCheckError::ResolverError(error) => error.into(),
Expand Down

0 comments on commit c04a7b7

Please sign in to comment.