Add "Add getter/setter" quick fix for uninitialized property

#KT-30078 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-03-19 17:18:20 +09:00
committed by Dmitry Gridin
parent efcc6f0967
commit f861b10798
17 changed files with 161 additions and 16 deletions
+5
View File
@@ -0,0 +1,5 @@
// "Add getter" "true"
// WITH_RUNTIME
class Test {
val x: Int<caret>
}
@@ -0,0 +1,8 @@
// "Add getter" "true"
// WITH_RUNTIME
class Test {
val x: Int
get() {
<caret>TODO()
}
}
+5
View File
@@ -0,0 +1,5 @@
// "Add getter and setter" "true"
// WITH_RUNTIME
class Test {
var x: Int<caret>
}
@@ -0,0 +1,9 @@
// "Add getter and setter" "true"
// WITH_RUNTIME
class Test {
var x: Int
get() {
<caret>TODO()
}
set(value) {}
}
@@ -0,0 +1,7 @@
// "Add setter" "true"
class Test {
var x: Int<caret>
get() {
return 1
}
}
@@ -0,0 +1,8 @@
// "Add setter" "true"
class Test {
var x: Int
get() {
return 1
}
set(value) {<caret>}
}
@@ -0,0 +1,6 @@
// "Add getter" "true"
// WITH_RUNTIME
class Test {
var x: Int<caret>
set(value) {}
}
@@ -0,0 +1,9 @@
// "Add getter" "true"
// WITH_RUNTIME
class Test {
var x: Int
get() {
<caret>TODO()
}
set(value) {}
}
@@ -3,6 +3,9 @@
// ACTION: Make 'a' abstract
// ACTION: Move to constructor parameters
// ACTION: Move to constructor
// ACTION: Add getter
// ACTION: Add getter and setter
// ACTION: Add setter
// ERROR: Property must be initialized or be abstract
class A {
@@ -4,6 +4,9 @@
// ACTION: Make 'a' abstract
// ACTION: Move to constructor parameters
// ACTION: Move to constructor
// ACTION: Add getter
// ACTION: Add getter and setter
// ACTION: Add setter
// ERROR: Property must be initialized or be abstract
class A {