Better human-readable presentation of ranges

This commit is contained in:
Tagir Valeev
2019-04-17 14:47:11 +07:00
parent 07f104c16f
commit e974f34ddc
9 changed files with 126 additions and 35 deletions
@@ -1,6 +1,6 @@
/*
Value is always true (s.length > 0)
Left operand range is {1..Integer.MAX_VALUE} (s.length)
Left operand is >= 1 (s.length)
Range is known from line #8 (s[0])
*/
class Test {
@@ -1,8 +1,8 @@
/*
Value is always false (s.length == list.size())
Left operand range is {1..Integer.MAX_VALUE} (s.length)
Left operand is >= 1 (s.length)
Range is known from line #12 (s[0])
Right operand range is {0} (list.size())
Right operand is 0 (list.size())
Range is known from line #13 (list.isEmpty())
*/
import java.util.List;
@@ -1,6 +1,6 @@
/*
Value is always false (x % 10 == 15)
Range of '%' result is {-9..9} (x % 10)
Result of '%' is in {-9..9} (x % 10)
*/
class Test {
void test(int x) {
@@ -1,12 +1,11 @@
/*
Value is always false (x * 2 == y * 2 + 1)
Range of '*' result is {Integer.MIN_VALUE..Integer.MAX_VALUE-1}: even (x * 2)
Range of '+' result is {-2147483647..Integer.MAX_VALUE}: odd (y * 2 + 1)
Range of '*' result is {Integer.MIN_VALUE..Integer.MAX_VALUE-1}: even (y * 2)
Result of '*' is even (x * 2)
Result of '+' is odd (y * 2 + 1)
Result of '*' is even (y * 2)
*/
class Test {
void test(int x, int y) {
// May produce better result in future (keep only mod info (even/odd), remove range which is irrelevant here)
if (<selection>x * 2 == y * 2 + 1</selection>) {
}