backing field migration fixes

This commit is contained in:
Dmitry Jemerov
2015-09-23 17:29:42 +02:00
parent 3d65b6fec2
commit dadef12723
10 changed files with 130 additions and 1 deletions
+6
View File
@@ -35,3 +35,9 @@ fun unnecessaryCast(x: String) = x as String
fun unnecessaryElvis(x: String) = x ?: ""
@JavaAnn(1, "abc") class MyClass
class Foo {
var x: Int = 0
get = $x
set(value) { $x = value }
}
+6
View File
@@ -34,3 +34,9 @@ fun unnecessaryCast(x: String) = x
fun unnecessaryElvis(x: String) = x
@JavaAnn(1, arg1 = "abc") class MyClass
class Foo {
var x: Int = 0
get = field
set(value) { field = value }
}
@@ -0,0 +1,7 @@
// "Migrate backing field syntax" "true"
class Foo {
var a: Int = 0
get() = 0
set(v) { $<caret>a = v }
}
@@ -0,0 +1,7 @@
// "Migrate backing field syntax" "true"
class Foo {
var a: Int = 0
get() = 0
set(v) { field = v }
}
@@ -0,0 +1,7 @@
// "Replace with property access" "true"
class A {
var foo: Int = 0
fun bar() = $f<caret>oo
}
@@ -0,0 +1,7 @@
// "Replace with property access" "true"
class A {
var foo: Int = 0
fun bar() = foo
}