Skip to content

Commit 90ff3ac

Browse files
committed
allow cases where rules are redundant for one of RHD/LHD
1 parent a700f7b commit 90ff3ac

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/main/scala/scripts/RedundantAdjacenciesChecker.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ object RedundantAdjacenciesChecker {
4848
case Some((rule, Rhd)) => isRedundantAdjacency(rule, rul2.lookupRuleRhd)
4949
case Some((rule, Lhd)) => isRedundantAdjacency(rule, rul2.lookupRuleLhd)
5050
case Some((rule, RhdAndLhd)) =>
51-
val b = isRedundantAdjacency(rule, rul2.lookupRuleRhd)
52-
require(
53-
b == isRedundantAdjacency(rule, rul2.lookupRuleLhd),
54-
s"Redundancies should be the same for RHD and LHD: $rule" // hopefully this will always be the case
55-
)
56-
b
51+
val b1 = isRedundantAdjacency(rule, rul2.lookupRuleRhd)
52+
val b2 = isRedundantAdjacency(rule, rul2.lookupRuleLhd)
53+
if (b1 != b2) {
54+
println(s"Rule is redundant for ${if (b1) "RHD" else "LHD"} only: $rule") // hopefully this rarely happens
55+
}
56+
b1 && b2
5757
case None => false // comments are not redundant
5858
}
5959

6060
if (redundant) {
61-
printer.println(s";${line.stripLineEnd}; redundant-adjacency") // comments out the line
61+
printer.println(s";${line.stripLineEnd}; redundant_adjacency") // comments out the line
6262
} else {
6363
printer.print(line) // preserving original linebreaks
6464
}

0 commit comments

Comments
 (0)