Inline Property also supported for properties with getter
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
||||
val Int.C = 239
|
||||
|
||||
// not implemented yet
|
||||
|
||||
fun f() {
|
||||
println(5.<caret>C)
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
val C: Int
|
||||
get() = 239
|
||||
|
||||
// not implemented yet
|
||||
|
||||
fun f() {
|
||||
println(<caret>C)
|
||||
}
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
val C = 239
|
||||
get() = $C + 1
|
||||
|
||||
|
||||
// not implemented yet
|
||||
|
||||
fun f() {
|
||||
println(<caret>C)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
val <caret>property: Int
|
||||
get {
|
||||
println("access!")
|
||||
return 1
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
println(property)
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
fun foo() {
|
||||
println("access!")
|
||||
println(1)
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import java.util.*
|
||||
|
||||
val <caret>property: Int
|
||||
get() = Random().nextInt()
|
||||
|
||||
fun foo() {
|
||||
println(property)
|
||||
}
|
||||
idea/testData/refactoring/inline/inlineVariableOrProperty/property/accessors/ExpressionBody.kt.after
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
import java.util.*
|
||||
|
||||
fun foo() {
|
||||
println(Random().nextInt())
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
val String.<caret>property: Int
|
||||
get() = length * 2
|
||||
|
||||
fun String.foo() {
|
||||
println("a".property)
|
||||
println(property)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun String.foo() {
|
||||
println("a".length * 2)
|
||||
println(length * 2)
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// ERROR: Cannot inline property with accessor(s) and backing field
|
||||
|
||||
val C = 239
|
||||
get() = field + 1
|
||||
|
||||
fun f() {
|
||||
println(<caret>C)
|
||||
}
|
||||
Reference in New Issue
Block a user