"introduce backing property" intention

This commit is contained in:
Dmitry Jemerov
2015-09-23 22:00:36 +02:00
parent dadef12723
commit e1acc8744d
27 changed files with 337 additions and 4 deletions
@@ -0,0 +1,11 @@
// "Introduce backing property" "true"
class Foo {
var x = ""
get() = $x + "!"
set(value) { $x = value + "!" }
fun foo(): String {
return $<caret>x
}
}
@@ -0,0 +1,12 @@
// "Introduce backing property" "true"
class Foo {
private var _x = ""
var x: String
get() = _x + "!"
set(value) { _x = value + "!" }
fun foo(): String {
return _x
}
}
@@ -1,5 +1,6 @@
// "Change 'A.x' type to '(Int) -> Int'" "false"
// ACTION: Change 'C.x' type to '(String) -> Int'
// ACTION: Introduce backing property
// ERROR: <html>Return type is '(kotlin.Int) &rarr; kotlin.Int', which is not a subtype of overridden<br/><b>public</b> <b>abstract</b> <b>val</b> x: (kotlin.String) &rarr; kotlin.Int <i>defined in</i> A</html>
interface A {
val x: (String) -> Int
+1
View File
@@ -1,5 +1,6 @@
// "Specify type explicitly" "false"
// ACTION: Convert property to function
// ACTION: Introduce backing property
// ERROR: Unresolved reference: foo
class A() {
@@ -1,5 +1,6 @@
// "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false"
// ACTION: Change 'A.x' type to '(Int) -> Int'
// ACTION: Introduce backing propertty
// ERROR: <html>Return type is '(kotlin.Int) &rarr; kotlin.Int', which is not a subtype of overridden<br/><b>public</b> <b>abstract</b> <b>val</b> x: (kotlin.String) &rarr; [ERROR : Ay] <i>defined in</i> A</html>
// ERROR: Unresolved reference: Ay
interface A {