Convert Function to Property: Forbid for properties with both initializer and getter

#KT-23293 Fixed
This commit is contained in:
Alexey Sedunov
2018-03-16 17:11:00 +03:00
parent 43b4a496e3
commit 0a0043a851
3 changed files with 12 additions and 1 deletions
@@ -191,7 +191,7 @@ class ConvertPropertyToFunctionIntention : SelfTargetingIntention<KtProperty>(Kt
override fun isApplicableTo(element: KtProperty, caretOffset: Int): Boolean {
val identifier = element.nameIdentifier ?: return false
if (!identifier.textRange.containsOffset(caretOffset)) return false
return element.delegate == null && !element.isVar && !element.isLocal
return element.delegate == null && !element.isVar && !element.isLocal && (element.initializer == null || element.getter == null)
}
override fun applyTo(element: KtProperty, editor: Editor?) {