Skip to content
Merged
Changes from all 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
23 changes: 20 additions & 3 deletions src/ghci/compilation_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,26 @@ impl CompilationLog {
/// If we start up in `--repl-no-load`, we don't get a compilation summary, but we don't want to
/// leave the error log empty, so we synthesize an "All good (0 modules)" message.
pub fn fill_empty_summary(&mut self) {
self.summary.get_or_insert(CompilationSummary {
result: CompilationResult::Ok,
modules_loaded: ModulesLoaded::Count(0),
self.summary.get_or_insert_with(|| {
// We usually infer the success status from the "Ok" or "Failed" message at the end of
// compilation. If we don't have that, let's use the presence of error diagnostics as a
// proxy.

let has_errors = self
.diagnostics
.iter()
.any(|diagnostic| diagnostic.severity == Severity::Error);

let result = if has_errors {
CompilationResult::Err
} else {
CompilationResult::Ok
};

CompilationSummary {
result,
modules_loaded: ModulesLoaded::Count(0),
}
});
}

Expand Down