refactor ConvertFunctionToPropertyIntention and fix 'Convert function to property shouldn't insert explicit type if it was inferred previously' (#1011)

Fixes #KT-14820
This commit is contained in:
Kirill Rakhman
2017-05-19 20:32:11 +02:00
committed by Dmitry Jemerov
parent 927cd04405
commit 4cbdbaa057
12 changed files with 99 additions and 37 deletions
@@ -3,12 +3,11 @@ interface T {
}
class A(val n: Int) {
val foo: T
get() = object : T {
override fun bar() {
val foo get() = object : T {
override fun bar() {
}
}
}
}
fun test() {
@@ -2,8 +2,7 @@ fun test() {
class X
class A(val n: Int) {
val foo: X
get() = X()
val foo get() = X()
}
val t = A(1).foo
@@ -1,6 +1,5 @@
class A(val n: Int) {
val foo: Boolean
get() = n > 1
val foo get() = n > 1
}
fun test() {
@@ -0,0 +1,4 @@
annotation class X(val s: String)
@X("")
fun foo<caret>(): String = ""
@@ -0,0 +1,5 @@
annotation class X(val s: String)
@X("")
val foo<caret>: String
get() = ""
@@ -0,0 +1,8 @@
annotation class X(val s: String)
// 1
@X("") // 2
/* 3 */ fun foo<caret>(): String {
// 4
return ""
}
@@ -0,0 +1,9 @@
annotation class X(val s: String)
// 1
@X("") // 2
/* 3 */ val foo<caret>: String
get() {
// 4
return ""
}
@@ -0,0 +1 @@
fun foo<caret>() = ""
@@ -0,0 +1 @@
val foo<caret> get() = ""