Minor: primary constructor to secondary: do not specify independent property type explicitly
This commit is contained in:
+1
-1
@@ -62,10 +62,10 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention<KtP
|
||||
val commentSaver = CommentSaver(element)
|
||||
val initializerMap = mutableMapOf<KtProperty, String>()
|
||||
for (property in klass.getProperties()) {
|
||||
if (property.isIndependent(klass, context)) continue
|
||||
if (property.typeReference == null) {
|
||||
SpecifyTypeExplicitlyIntention().applyTo(property, editor)
|
||||
}
|
||||
if (property.isIndependent(klass, context)) continue
|
||||
val initializer = property.initializer!!
|
||||
initializerMap[property] = initializer.text
|
||||
initializer.delete()
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ class Hello {
|
||||
this.z = x + y
|
||||
}
|
||||
|
||||
val y: String = "Hello"
|
||||
val y = "Hello"
|
||||
|
||||
val z: String
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ class Hello {
|
||||
this.z = x + y
|
||||
}
|
||||
|
||||
val y: String = Storage.hello
|
||||
val y = Storage.hello
|
||||
|
||||
val z: String
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -6,6 +6,6 @@ fun foo(x: Int) {
|
||||
this.y = y
|
||||
}
|
||||
|
||||
val z: Int = x
|
||||
val z = x
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -6,8 +6,8 @@ class My {
|
||||
println(y)
|
||||
}
|
||||
|
||||
val x: Int = 1
|
||||
val x = 1
|
||||
|
||||
val y: Int = 2
|
||||
val y = 2
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user