Partial body resolve: added more tests

This commit is contained in:
Valentin Kipyatkov
2014-11-21 12:19:23 +03:00
parent 0dd77a8ed3
commit 058af69078
13 changed files with 181 additions and 3 deletions
@@ -0,0 +1,7 @@
Resolve target: null
----------------------------------------------
fun foo(p: Any?, c: Collection<String>) {
// STATEMENT DELETED: for (e in c) { print(p!!) }
<caret>xxx
}
@@ -0,0 +1,7 @@
fun foo(p: Any?, c: Collection<String>) {
for (e in c) {
print(p!!)
}
<caret>xxx
}
@@ -0,0 +1,31 @@
Resolve target: value-parameter val p: kotlin.String? smart-cast to kotlin.String
----------------------------------------------
fun foo(p: String?, x: Boolean, y: Boolean, z: Boolean, t: Boolean) {
if (p == null) {
if (x) {
// STATEMENT DELETED: print("x")
error("error")
}
else if (y) {
// STATEMENT DELETED: print("y")
if (z) {
// STATEMENT DELETED: print("z")
return
}
else {
throw Exception()
}
}
else {
if (t) {
// STATEMENT DELETED: print("t")
return
}
else {
return
}
}
}
<caret>p.length
}
@@ -0,0 +1,29 @@
fun foo(p: String?, x: Boolean, y: Boolean, z: Boolean, t: Boolean) {
if (p == null) {
if (x) {
print("x")
error("error")
}
else if (y) {
print("y")
if (z) {
print("z")
return
}
else {
throw Exception()
}
}
else {
if (t) {
print("t")
return
}
else {
return
}
}
}
<caret>p.length
}
@@ -0,0 +1,16 @@
Resolve target: val x: kotlin.Any?
----------------------------------------------
fun foo() {
@MainLoop
for (i in 1..10) {
val x = take()
if (x == null) {
while (true) {
break@MainLoop
}
}
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,14 @@
fun foo() {
@MainLoop
for (i in 1..10) {
val x = take()
if (x == null) {
while (true) {
break@MainLoop
}
}
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,16 @@
Resolve target: val x: kotlin.Any?
----------------------------------------------
fun foo() {
@MainLoop
for (i in 1..10) {
val x = take()
if (x == null) {
while (true) {
continue@MainLoop
}
}
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,14 @@
fun foo() {
@MainLoop
for (i in 1..10) {
val x = take()
if (x == null) {
while (true) {
continue@MainLoop
}
}
<caret>x.hashCode()
}
}
fun take(): Any? = null
@@ -0,0 +1,8 @@
Resolve target: val v: kotlin.String
----------------------------------------------
val v = ""
fun foo(s: String = <caret>v) {
// STATEMENT DELETED: val local = 1
// STATEMENT DELETED: print("foo" + local)
}
@@ -0,0 +1,6 @@
val v = ""
fun foo(s: String = <caret>v) {
val local = 1
print("foo" + local)
}