Quick Fixes: Implement 'Move to constructor parameters' quick-fix
#KT-6604 In Progress
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
fun test() {
|
||||
<caret>val n: Int
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Make 'n' abstract
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
class A {
|
||||
<caret>val Int.n: Int
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
// SHOULD_FAIL_WITH: Duplicating parameter 'n'
|
||||
open class A(n: Int) {
|
||||
<caret>val n: Int
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a = A(0)
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
open class A {
|
||||
<caret>val n: Int
|
||||
}
|
||||
|
||||
class B : A()
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
open class A(val n: Int) {
|
||||
}
|
||||
|
||||
class B : A(0)
|
||||
|
||||
fun test() {
|
||||
val a = A(0)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Initialize property 'n'
|
||||
// ACTION: Make 'n' abstract
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A(x: Int)
|
||||
|
||||
class B : A {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor(): super(1)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Initialize property 'n'
|
||||
// ACTION: Make 'n' abstract
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A
|
||||
|
||||
class B {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor()
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
open class A(s: String) {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor(a: Int): this("")
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
open class A(s: String, val n: Int) {
|
||||
|
||||
constructor(a: Int): this("", 0)
|
||||
}
|
||||
|
||||
class B : A("", 0)
|
||||
|
||||
fun test() {
|
||||
val a = A("", 0)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
interface A {
|
||||
<caret>val n: Int
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Initialize property 'n'
|
||||
// ACTION: Make 'n' abstract
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
object A {
|
||||
<caret>val n: Int
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
class A {
|
||||
<caret>val n: Int by lazy { 0 }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
annotation class foo
|
||||
|
||||
open class A(s: String) {
|
||||
<caret>private @foo val /*1*/ n: /* 2 */ Int
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Move to constructor parameters" "true"
|
||||
annotation class foo
|
||||
|
||||
open class A(s: String, private @foo val /*1*/ n: /* 2 */ Int) {
|
||||
}
|
||||
|
||||
class B : A("", 0)
|
||||
|
||||
fun test() {
|
||||
val a = A("", 0)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
|
||||
// ACTION: Initialize property 'n'
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: Property must be initialized
|
||||
<caret>val n: Int
|
||||
Reference in New Issue
Block a user