Do not resolve all bodies of anonymous objects and local classes in partial body resolve

This commit is contained in:
Valentin Kipyatkov
2016-10-28 22:12:13 +03:00
parent 23c22984e8
commit c0d89e67a9
11 changed files with 80 additions and 27 deletions
@@ -7,18 +7,18 @@ open class C(p: Int) {
fun foo(p: String?) {
val o = object : Runnable {
override fun run() {
if (p == null) return
print(p.size)
/* STATEMENT DELETED: if (p == null) return */
/* STATEMENT DELETED: print(p.length) */
}
}
val c = object : C(p!!.size) {
override fun f() {
super.f()
if (p == null) return
print(p.size)
/* STATEMENT DELETED: super.f() */
/* STATEMENT DELETED: if (p == null) return */
/* STATEMENT DELETED: print(p.length) */
}
}
<caret>p?.size
}
<caret>p?.length
}
@@ -5,15 +5,15 @@ open class C(p: Int) {
}
fun foo(p: String?) {
/* STATEMENT DELETED: val o = object : Runnable { override fun run() { if (p == null) return print(p.size) } } */
/* STATEMENT DELETED: val o = object : Runnable { override fun run() { if (p == null) return print(p.length) } } */
val c = object : C(p!!.size) {
override fun f() {
super.f()
if (p == null) return
print(p.size)
/* STATEMENT DELETED: super.f() */
/* STATEMENT DELETED: if (p == null) return */
/* STATEMENT DELETED: print(p.length) */
}
}
<caret>p?.size
}
<caret>p?.length
}
@@ -6,7 +6,7 @@ fun foo(p: String?) {
val o = object : Runnable {
override fun run() {
if (p == null) return
print(p.size)
print(p.length)
}
}
@@ -14,9 +14,9 @@ fun foo(p: String?) {
override fun f() {
super.f()
if (p == null) return
print(p.size)
print(p.length)
}
}
<caret>p?.size
<caret>p?.length
}
@@ -0,0 +1,23 @@
Resolve target: val length: kotlin.Int
----------------------------------------------
open class C(p: Int) {
open fun f(){}
}
fun foo(p1: String?, p2: String?) {
if (p1 == null) return
/* STATEMENT DELETED: println(p1) */
val c = object : C(p1.length) {
override fun f() {
/* STATEMENT DELETED: super.f() */
if (p2 == null) return
print(p2.<caret>length)
/* STATEMENT DELETED: bar() */
}
fun bar() {
/* STATEMENT DELETED: print(1) */
}
}
}
@@ -0,0 +1,21 @@
open class C(p: Int) {
open fun f(){}
}
fun foo(p1: String?, p2: String?) {
if (p1 == null) return
println(p1)
val c = object : C(p1.length) {
override fun f() {
super.f()
if (p2 == null) return
print(p2.<caret>length)
bar()
}
fun bar() {
print(1)
}
}
}
@@ -3,9 +3,9 @@ Resolve target: value-parameter p: kotlin.String?
fun foo(p: String?) {
class LocalClass {
fun f(): String? {
if (p == null) return null
print(p.size)
return ""
/* STATEMENT DELETED: if (p == null) return null */
/* STATEMENT DELETED: print(p.size) */
/* STATEMENT DELETED: return "" */
}
}