Apply suggestions from code review

Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
This commit is contained in:
yoff
2024-11-19 13:37:53 +01:00
committed by GitHub
parent 15953bf569
commit 6ed895064f
2 changed files with 6 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
public class B {
public int forloop() {
int result = 0;
for (int i = 0; i < 10; i++) {// $ bound="i in [0..10]" bound="i in [0..9]"
for (int i = 0;
i < 10; // $ bound="i in [0..10]"
i++) { // $ bound="i in [0..9]"
result = i; // $ bound="i in [0..9]"
}
return result; // $ bound="result in [0..9]"

View File

@@ -5,9 +5,7 @@
import java
import semmle.code.java.dataflow.RangeAnalysis
private import codeql.util.test.InlineExpectationsTest
private import TestUtilities.internal.InlineExpectationsTestImpl
private import Make<Impl> as IET
private import TestUtilities.InlineExpectationsTest as IET
module RangeTest implements IET::TestSig {
string getARelevantTag() { result = "bound" }
@@ -29,8 +27,8 @@ module RangeTest implements IET::TestSig {
}
private predicate constrained(Expr e, int lower, int upper) {
lower = min(int delta | bounded(e, any(ZeroBound z), delta, false, _)) and
upper = min(int delta | bounded(e, any(ZeroBound z), delta, true, _))
bounded(e, any(ZeroBound z), lower, false, _) and
bounded(e, any(ZeroBound z), upper, true, _)
}
}