[java-dfa] Equality of DfaWrappedValue does not mean the total equality

GitOrigin-RevId: 8c1faec2cd6c5cbdd7b89f442cb46e2bf3ebd951
This commit is contained in:
Tagir Valeev
2021-04-19 12:04:06 +07:00
committed by intellij-monorepo-bot
parent c6f8b35d04
commit c3a343e08b
2 changed files with 6 additions and 2 deletions

View File

@@ -931,7 +931,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
}
}
if (dfaLeft == dfaRight) {
if (dfaLeft == dfaRight && !(dfaLeft instanceof DfaWrappedValue)) {
return !isNegated || (dfaLeft instanceof DfaVariableValue && ((DfaVariableValue)dfaLeft).containsCalls());
}

View File

@@ -88,11 +88,15 @@ class StringSubstring {
if (<warning descr="Condition 's2.length() != 4' is always 'false'">s2.length() != 4</warning>) {}
}
}
void testSubstringVarRef(String s, int from, int length) {
String s1 = s.substring(0, length);
if (<warning descr="Condition 's1.length() == length' is always 'true'">s1.length() == length</warning>) {}
String s2 = s.substring(from, from + length);
if (<warning descr="Condition 's2.length() == length' is always 'true'">s2.length() == length</warning>) {}
}
public static boolean testSubstringEquals(String s1, String s2, int idx) {
return s1.substring(0, idx).equals(s2.substring(0, idx));
}
}