Skip to content

Commit

Permalink
make eqwalizer parse-all results deterministic on parse failure
Browse files Browse the repository at this point in the history
Summary:
Eqwalizer can only generate a result when it is given files without errors.
If it is unable to compile a particulare file, it returns a status of `NoAst` with the module name.
In a test, we check for this behaviour while processing a whole project, but also look for errors reported on a specific module.
The test project has more than one that can fail.
In the case of more than one module failure, make the combination process deterministic so the test will always report detailed errors on the same module, however the parallel processing does the actual eqwalizer process.

Reviewed By: michalmuskala

Differential Revision: D50557011

fbshipit-source-id: fb5eb6e7c29d2a976d159f3a772222390d957edc
  • Loading branch information
alanz authored and facebook-github-bot committed Oct 23, 2023
1 parent e3583c7 commit 052960d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/eqwalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,20 @@ pub struct EqwalizerDiagnostic {
impl EqwalizerDiagnostics {
pub fn combine(mut self, other: Self) -> Self {
match &mut self {
EqwalizerDiagnostics::NoAst { .. } => self,
EqwalizerDiagnostics::NoAst {
module: self_module,
} => match &other {
EqwalizerDiagnostics::NoAst {
module: other_module,
} => {
if other_module > self_module {
self
} else {
other
}
}
_ => self,
},
EqwalizerDiagnostics::Error(_) => self,
EqwalizerDiagnostics::Diagnostics { errors, type_info } => match other {
EqwalizerDiagnostics::Diagnostics {
Expand Down

0 comments on commit 052960d

Please sign in to comment.