When defining an @IR rule with failOn and counts attributes, one could end up with impossible constraints which always fail.
Example:
@Test
@Arguments(Argument.RANDOM_EACH)
@IR(failOn = {IRNode.LOAD, IRNode.STORE, IRNode.MUL, IRNode.DIV, IRNode.SUB})
@IR(counts = {IRNode.SUB, "1", IRNode.SUB, ">2"})with failOn
public int simpleOne(int x) {
return 2020 - x;
}
IRNode.SUB should not appear (failOn) while it needs to be found exactly once (counts #1) an appear more than 2 times (counts #2).
An idea is to catch such cases an immediately throw an exception to warn the user about such impossible rules.