infer contracts from comparisons with non-null value

This commit is contained in:
peter
2014-12-08 20:46:38 +01:00
parent 1bb8e60e6e
commit 7c0eb3e5ad
2 changed files with 27 additions and 8 deletions
@@ -415,11 +415,20 @@ class ContractInferenceFromSourceTest extends LightCodeInsightFixtureTestCase {
public void "test compare with string literal"() {
def c = inferContracts("""
String cast(String s) {
String s(String s) {
return s == "a" ? "b" : null;
}
""")
assert c == []
assert c == ['null -> null']
}
public void "test negative compare with string literal"() {
def c = inferContracts("""
String s(String s) {
return s != "a" ? "b" : null;
}
""")
assert c == ['null -> !null']
}
public void "test return after if without else"() {