Basic implementation of partial body resolve

This commit is contained in:
Valentin Kipyatkov
2014-11-17 20:20:16 +03:00
parent 9809e4fd0a
commit a675b5ba38
56 changed files with 852 additions and 32 deletions
@@ -0,0 +1,6 @@
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
Skipped statements:
y(p as? Int)
z(f() as String)
p1 as String
z(p1 as String)
@@ -0,0 +1,19 @@
fun foo(p: Any, p1: Any?) {
x(e.f as String)
y(p as? Int)
z(f() as String)
if (a) {
print((p as String).size)
}
else {
print((p as String).length)
}
if (y()) {
print(<caret>p.size)
p1 as String
}
z(p1 as String)
}
@@ -0,0 +1,5 @@
Resolve target: value-parameter val p: kotlin.String? smart-casted to kotlin.String
Skipped statements:
y(f()!!)
p1!!
z(p1!!)
@@ -0,0 +1,18 @@
fun foo(p: String?, p1: Any?) {
x(e.f!!)
y(f()!!)
if (a) {
print(p!!.size)
}
else {
print(p!!.length)
}
if (y()) {
print(<caret>p.size)
p1!!
}
z(p1!!)
}
@@ -0,0 +1,6 @@
Resolve target: val v2: kotlin.Int
Skipped statements:
x()
run { val v2 = 1 println(v2) }
run { val v2 = 2 println(v2) }
z()
@@ -0,0 +1,24 @@
fun foo(p: Int) {
x()
val v1 = p * p
if (y()) {
val v2 = v1 * v1
val v3 = v1 * v2
run {
val v2 = 1
println(v2)
}
print(<caret>v2)
run {
val v2 = 2
println(v2)
}
}
z()
}
@@ -0,0 +1,2 @@
Resolve target: value-parameter val o: kotlin.Any? smart-casted to kotlin.Any
Skipped statements:
@@ -0,0 +1,9 @@
fun foo(o: Any?, p: Int) {
if (p > 0) {
if (o == null) return
}
else {
if (o !is String) return
}
<caret>o.javaClass
}
@@ -0,0 +1,2 @@
Resolve target: value-parameter val o: kotlin.String? smart-casted to kotlin.String
Skipped statements:
@@ -0,0 +1,4 @@
fun foo(o: String?, o1: String) {
if (o != o1) return
<caret>o.hashCode()
}
@@ -0,0 +1,2 @@
Resolve target: val kotlin.String.size: kotlin.Int
Skipped statements:
@@ -0,0 +1,6 @@
fun foo(p: Any) {
if (p !is String) {
error("Not String")
}
println(<caret>p.size)
}
@@ -0,0 +1,3 @@
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.String
Skipped statements:
print("null")
@@ -0,0 +1,12 @@
fun foo(p: Any?) {
if (p !is String) {
if (p == null) {
print("null")
return
}
else {
return
}
}
println(<caret>p.size)
}
@@ -0,0 +1,2 @@
Resolve target: val v: kotlin.Any smart-casted to kotlin.String
Skipped statements:
@@ -0,0 +1,6 @@
class C(public val v: Any)
fun foo(c: C) {
if (c.v !is String) return
println(c.<caret>v.size)
}
@@ -0,0 +1,2 @@
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
Skipped statements:
@@ -0,0 +1,6 @@
fun foo(p: Any) {
if (p !is String) {
throw IllegalArgumentException()
}
println(<caret>p.size)
}
@@ -0,0 +1,3 @@
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.Any
Skipped statements:
print("not null")
@@ -0,0 +1,9 @@
fun foo(p: Any?) {
if (p != null) {
print("not null")
}
else {
return
}
<caret>p.hashCode()
}
@@ -0,0 +1,3 @@
Resolve target: value-parameter val p: kotlin.Any?
Skipped statements:
if (p != null) return
@@ -0,0 +1,4 @@
fun foo(p: Any?) {
if (p != null) return
<caret>p.hashCode()
}
@@ -0,0 +1,2 @@
Resolve target: val x: kotlin.Any? smart-casted to kotlin.Any
Skipped statements:
@@ -0,0 +1,9 @@
fun foo() {
for (i in 1..10) {
val x = take()
if (x == null) break
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,2 @@
Resolve target: val x: kotlin.Any? smart-casted to kotlin.Any
Skipped statements:
@@ -0,0 +1,9 @@
fun foo() {
for (i in 1..10) {
val x = take()
if (x == null) continue
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,3 @@
Resolve target: value-parameter val p: kotlin.Any?
Skipped statements:
if (p == null) { print("null") }
@@ -0,0 +1,6 @@
fun foo(p: Any?) {
if (p == null) {
print("null")
}
<caret>p.hashCode()
}
@@ -0,0 +1,3 @@
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.Any
Skipped statements:
print("null")
@@ -0,0 +1,7 @@
fun foo(p: Any?) {
if (p == null) {
print("null")
return
}
<caret>p.hashCode()
}
@@ -0,0 +1,3 @@
Resolve target: val kotlin.String.size: kotlin.Int
Skipped statements:
if (x()) return
@@ -0,0 +1,4 @@
fun foo(p: String) {
if (x()) return
println(p.<caret>size)
}
@@ -0,0 +1,2 @@
Resolve target: null
Skipped statements:
@@ -0,0 +1,6 @@
fun foo(s: String){}
fun foo(c: Char){}
fun bar(b: Boolean, s: String, c: Char){
foo(if (b) "abc" else <caret>xxx)
}
@@ -0,0 +1,3 @@
Resolve target: fun f(): kotlin.Unit
Skipped statements:
x()
@@ -0,0 +1,8 @@
class C {
fun f(){}
}
fun foo() {
val lambda = {() -> x(); C() }
lambda().<caret>f()
}
@@ -0,0 +1,4 @@
Resolve target: value-parameter val p: kotlin.Int
Skipped statements:
x()
z()
@@ -0,0 +1,7 @@
fun foo(p: Int) {
x()
if (y()) {
print(<caret>p)
}
z()
}