accidentally forgot about improvements if there were multiplie candidates

This commit is contained in:
Oliver Schneider 2016-03-29 16:27:06 +02:00
parent be7288303a
commit 216edbae59
3 changed files with 6 additions and 3 deletions

View File

@ -23,7 +23,7 @@ regex_macros = { version = "0.1.33", optional = true }
semver = "0.2.1"
toml = "0.1"
unicode-normalization = "0.1"
quine-mc_cluskey = "0.2.1"
quine-mc_cluskey = "0.2.2"
[dev-dependencies]
compiletest_rs = "0.1.0"

View File

@ -275,7 +275,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
return;
}
// if the number of occurrences of a terminal decreases or any of the stats decreases while none increases
improvement = (stats.terminals[i] > simplified_stats.terminals[i]) ||
improvement |= (stats.terminals[i] > simplified_stats.terminals[i]) ||
(stats.negations > simplified_stats.negations && stats.ops == simplified_stats.ops) ||
(stats.ops > simplified_stats.ops && stats.negations == simplified_stats.negations);
}

View File

@ -77,5 +77,8 @@ fn equality_stuff() {
//|~ SUGGESTION let _ = false;
let _ = a > b && a == b;
let _ = a != b || !(a != b || c == d);
let _ = a != b || !(a != b || c == d); //~ ERROR this boolean expression can be simplified
//|~ HELP for further information visit
//|~ SUGGESTION let _ = !c == d || a != b;
//|~ SUGGESTION let _ = !(!a != b && c == d);
}