mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-22 19:42:31 +00:00
make file loading errors that happen late in compilation still fatal
This commit is contained in:
parent
21d063da26
commit
8f4945f286
9 changed files with 189 additions and 114 deletions
|
@ -7,6 +7,7 @@ use roc_solve_problem::TypeError;
|
|||
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Problems {
|
||||
pub fatally_errored: bool,
|
||||
pub errors: usize,
|
||||
pub warnings: usize,
|
||||
}
|
||||
|
@ -65,6 +66,7 @@ pub fn report_problems(
|
|||
// never need to re-allocate either the warnings or the errors vec!
|
||||
let mut warnings = Vec::with_capacity(total_problems);
|
||||
let mut errors = Vec::with_capacity(total_problems);
|
||||
let mut fatally_errored = false;
|
||||
|
||||
for (home, (module_path, src)) in sources.iter() {
|
||||
let mut src_lines: Vec<&str> = Vec::new();
|
||||
|
@ -92,6 +94,10 @@ pub fn report_problems(
|
|||
RuntimeError => {
|
||||
errors.push(buf);
|
||||
}
|
||||
Fatal => {
|
||||
fatally_errored = true;
|
||||
errors.push(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,6 +117,10 @@ pub fn report_problems(
|
|||
RuntimeError => {
|
||||
errors.push(buf);
|
||||
}
|
||||
Fatal => {
|
||||
fatally_errored = true;
|
||||
errors.push(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +154,7 @@ pub fn report_problems(
|
|||
}
|
||||
|
||||
Problems {
|
||||
fatally_errored,
|
||||
errors: errors.len(),
|
||||
warnings: warnings.len(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue