Inline refactoring: improve resolve

#KT-39705 Fixed
#KT-19459 Fixed
This commit is contained in:
Dmitry Gridin
2020-06-19 18:16:27 +07:00
parent 5ad94daaa5
commit 360a5bf348
24 changed files with 232 additions and 61 deletions
+13
View File
@@ -0,0 +1,13 @@
private class A {
val bar = 1
val parent: A
get() = null!!
}
fun <T> myrun(f: () -> T) = f()
private fun A.<caret>foo() = myrun { bar }
private fun test(a: A) {
a.foo()
}
@@ -0,0 +1,11 @@
private class A {
val bar = 1
val parent: A
get() = null!!
}
fun <T> myrun(f: () -> T) = f()
private fun test(a: A) {
myrun { a.bar }
}
@@ -0,0 +1,13 @@
private class A {
fun <caret>foooo() {
{ bar }()
}
companion object {
const val bar = 4
}
}
private fun test(a: A) {
a.foooo()
}
@@ -0,0 +1,12 @@
import A.Companion.bar
private class A {
companion object {
const val bar = 4
}
}
private fun test(a: A) {
{ bar }()
}
@@ -0,0 +1,16 @@
package abc
private class A {
fun <caret>foooo() {
{ bar }()
}
companion object {
const val bar = 4
}
}
private fun test(a: A) {
val bar = 42
a.foooo()
}
@@ -0,0 +1,13 @@
package abc
private class A {
companion object {
const val bar = 4
}
}
private fun test(a: A) {
val bar = 42
{ A.bar }()
}
@@ -0,0 +1,10 @@
private class A {
val bar = 1
fun <caret>foooo() {
{ bar }()
}
}
private fun test(a: A) {
a.foooo()
}
@@ -0,0 +1,7 @@
private class A {
val bar = 1
}
private fun test(a: A) {
{ a.bar }()
}
@@ -0,0 +1,11 @@
private class A {
val bar = 1
fun <caret>foooo() {
{ this.bar }()
bar
}
}
private fun test(a: A) {
a.foooo()
}
@@ -0,0 +1,8 @@
private class A {
val bar = 1
}
private fun test(a: A) {
{ a.bar }()
a.bar
}
@@ -10,13 +10,13 @@ object Foo {
internal object Bar {
@JvmStatic fun main(args: Array<String>) {
bar(object : Runnable {
override fun run() {
doRun()
}
override fun run() {
doRun()
}
private fun doRun() {
// Woo-hoo
}
})
private fun doRun() {
// Woo-hoo
}
})
}
}