Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Report compilation warnings before errors #2398

Merged
merged 7 commits into from
Aug 23, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/noirc_errors/src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,18 @@ pub fn report_all(
diagnostics: &[FileDiagnostic],
deny_warnings: bool,
) -> ReportedErrors {
let mut ordered_diagnostics = Vec::new();
let mut ordered_errors = Vec::new();
for diagnostic in diagnostics {
if diagnostic.diagnostic.is_warning() {
ordered_diagnostics.push(diagnostic);
} else {
ordered_errors.push(diagnostic);
}
}
Ethan-000 marked this conversation as resolved.
Show resolved Hide resolved
ordered_diagnostics.append(&mut ordered_errors);
Ethan-000 marked this conversation as resolved.
Show resolved Hide resolved
let error_count =
diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum();
ordered_diagnostics.iter().map(|error| error.report(files, deny_warnings) as u32).sum();
Ethan-000 marked this conversation as resolved.
Show resolved Hide resolved

ReportedErrors { error_count }
}
Expand Down