From 6f5b3aebe1ced3d2652a579a4148e505bb872c22 Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Wed, 22 Apr 2020 21:56:51 +0700 Subject: [PATCH] KotlinIntroduceVariableHandler: fix CCE for destruction declaration #EA-219701 Fixed --- .../introduceVariable/KotlinIntroduceVariableHandler.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt index d61fa48bad1..0f83ed081d3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt @@ -207,7 +207,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler { reference = SmartPointerManager.createPointer(elem as KtExpression) } emptyBody.addAfter(psiFactory.createNewLine(), firstChild) - property = emptyBody.addAfter(property, firstChild) as KtProperty + property = emptyBody.addAfter(property, firstChild) as KtDeclaration emptyBody.addAfter(psiFactory.createNewLine(), firstChild) actualExpression = reference?.element ?: return diff = actualExpression.textRange.startOffset - emptyBody.textRange.startOffset @@ -232,7 +232,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler { val copyTo = parent.lastChild val copyFrom = anchor.nextSibling - property = emptyBody.addAfter(property, firstChild) as KtProperty + property = emptyBody.addAfter(property, firstChild) as KtDeclaration emptyBody.addAfter(psiFactory.createNewLine(), firstChild) if (copyFrom != null && copyTo != null) { emptyBody.addRangeAfter(copyFrom, copyTo, property)