Minor: primary constructor to secondary: do not specify independent property type explicitly

This commit is contained in:
Mikhail Glukhikh
2016-10-24 20:34:40 +03:00
parent a74f010e0f
commit 35d104782e
5 changed files with 6 additions and 6 deletions
@@ -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()
@@ -6,7 +6,7 @@ class Hello {
this.z = x + y
}
val y: String = "Hello"
val y = "Hello"
val z: String
}
@@ -10,7 +10,7 @@ class Hello {
this.z = x + y
}
val y: String = Storage.hello
val y = Storage.hello
val z: String
}
@@ -6,6 +6,6 @@ fun foo(x: Int) {
this.y = y
}
val z: Int = x
val z = x
}
}
@@ -6,8 +6,8 @@ class My {
println(y)
}
val x: Int = 1
val x = 1
val y: Int = 2
val y = 2
}