Partial body resolve filter works more precisely for if-statements

This commit is contained in:
Valentin Kipyatkov
2015-03-24 22:24:13 +03:00
parent 7a414336c1
commit 176ba937ba
11 changed files with 150 additions and 27 deletions
@@ -0,0 +1,6 @@
Resolve target: value-parameter val p: kotlin.Any?
----------------------------------------------
fun foo(p: Any?) {
/* STATEMENT DELETED: if (x(p == null)) { print("returned true") return } */
<caret>p?.hashCode()
}
@@ -0,0 +1,7 @@
fun foo(p: Any?) {
if (x(p == null)) {
print("returned true")
return
}
<caret>p?.hashCode()
}
@@ -0,0 +1,6 @@
Resolve target: value-parameter val p: kotlin.Any?
----------------------------------------------
fun foo(p: Any?) {
/* STATEMENT DELETED: if (p is String) return */
println(<caret>p.hashCode())
}
@@ -0,0 +1,4 @@
fun foo(p: Any?) {
if (p is String) return
println(<caret>p.hashCode())
}
@@ -0,0 +1,6 @@
Resolve target: value-parameter val p1: kotlin.Any?
----------------------------------------------
fun foo(p1: Any?, p2: Any?) {
/* STATEMENT DELETED: if (p1 == null && p2 == null) { print("2 null's") return } */
<caret>p1?.hashCode()
}
@@ -0,0 +1,7 @@
fun foo(p1: Any?, p2: Any?) {
if (p1 == null && p2 == null) {
print("2 null's")
return
}
<caret>p1?.hashCode()
}
@@ -0,0 +1,9 @@
Resolve target: value-parameter val p1: kotlin.Any? smart-cast to kotlin.Any
----------------------------------------------
fun foo(p1: Any?, p2: Any?) {
if (p1 == null || p2 == null) {
/* STATEMENT DELETED: print("null") */
return
}
<caret>p1.hashCode()
}
@@ -0,0 +1,7 @@
fun foo(p1: Any?, p2: Any?) {
if (p1 == null || p2 == null) {
print("null")
return
}
<caret>p1.hashCode()
}