Quick Fixes: Implement 'Initialize with constructor parameter' quick-fix
#KT-6604 Fixed
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
fun test() {
|
||||
<caret>val n: Int
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(n: Int) {
|
||||
<caret>var n: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A(0)
|
||||
|
||||
fun test() {
|
||||
val a = A(0)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(n: Int, n1: Int) {
|
||||
var n: Int = n1
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A(0, 0)
|
||||
|
||||
fun test() {
|
||||
val a = A(0, 0)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor(n: Int)
|
||||
}
|
||||
|
||||
class B : A(1)
|
||||
|
||||
fun test() {
|
||||
val a = A(1)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A {
|
||||
val n: Int
|
||||
|
||||
constructor(n: Int, n1: Int) {
|
||||
this.n = n1
|
||||
}
|
||||
}
|
||||
|
||||
class B : A(1, 0)
|
||||
|
||||
fun test() {
|
||||
val a = A(1, 0)
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A {
|
||||
<caret>var n: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A()
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(n: Int) {
|
||||
var n: Int = n
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A(0)
|
||||
|
||||
fun test() {
|
||||
val a = A(0)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(s: String) {
|
||||
<caret>var n: Int
|
||||
get() = 1
|
||||
|
||||
constructor(): this("")
|
||||
constructor(a: Int): this("" + a)
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(s: String, n: Int) {
|
||||
var n: Int = n
|
||||
get() = 1
|
||||
|
||||
constructor(): this("", 0)
|
||||
constructor(a: Int): this("" + a, 0)
|
||||
}
|
||||
|
||||
class B : A("", 0)
|
||||
|
||||
fun test() {
|
||||
val a = A("", 0)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(s: String) {
|
||||
<caret>var n: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A(s: String, n: Int) {
|
||||
var n: Int = n
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class B : A("", 0)
|
||||
|
||||
fun test() {
|
||||
val a = A("", 0)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor(s: String)
|
||||
|
||||
constructor(a: Int) {
|
||||
val t = 1
|
||||
}
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
class C : A(1)
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
val aa = A(1)
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// "Initialize with constructor parameter" "true"
|
||||
open class A {
|
||||
val n: Int
|
||||
|
||||
constructor(s: String, n: Int) {
|
||||
this.n = n
|
||||
}
|
||||
|
||||
constructor(a: Int, n: Int) {
|
||||
val t = 1
|
||||
this.n = n
|
||||
}
|
||||
}
|
||||
|
||||
class B : A("", 0)
|
||||
|
||||
class C : A(1, 0)
|
||||
|
||||
fun test() {
|
||||
val a = A("", 0)
|
||||
val aa = A(1, 0)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
interface A {
|
||||
<caret>val n: Int
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "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
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A {
|
||||
<caret>val n: Int
|
||||
}
|
||||
|
||||
class B : A()
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A(s: String) {
|
||||
<caret>val n: Int
|
||||
|
||||
constructor(): this("")
|
||||
constructor(a: Int): this("" + a)
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A(s: String) {
|
||||
<caret>val n: Int
|
||||
}
|
||||
|
||||
class B : A("")
|
||||
|
||||
fun test() {
|
||||
val a = A("")
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
class A {
|
||||
<caret>val n: Int by lazy { 0 }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
|
||||
// ACTION: Initialize property 'n'
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: Property must be initialized
|
||||
<caret>val n: Int
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ACTION: Initialize with constructor parameter
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A(x: Int)
|
||||
|
||||
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ACTION: Make protected
|
||||
// ACTION: Initialize with constructor parameter
|
||||
// ERROR: Property must be initialized or be abstract
|
||||
open class A
|
||||
|
||||
|
||||
Reference in New Issue
Block a user