Skip to content

Commit

Permalink
chore(errors): Refactor error representation in compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ymadzhunkov committed Sep 25, 2023
1 parent 0490549 commit a7ef0e7
Show file tree
Hide file tree
Showing 10 changed files with 443 additions and 320 deletions.
6 changes: 5 additions & 1 deletion compiler/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ pub fn check_crate(
deny_warnings: bool,
) -> CompilationResult<()> {
let mut errors = vec![];
CrateDefMap::collect_defs(crate_id, context, &mut errors);
let diagnostics = CrateDefMap::collect_defs(crate_id, context);
errors.extend(diagnostics.into_iter().map(|(error, file_id)| {
let diagnostic: CustomDiagnostic = error.into();
diagnostic.in_file(file_id)
}));

if has_errors(&errors, deny_warnings) {
Err(errors)
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_errors/src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl std::fmt::Display for CustomDiagnostic {

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CustomLabel {
message: String,
pub message: String,
pub span: Span,
}

Expand Down
Loading

0 comments on commit a7ef0e7

Please sign in to comment.