diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertDotQualifiedToScopeIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertDotQualifiedToScopeIntention.kt deleted file mode 100644 index 88c3f02e693..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertDotQualifiedToScopeIntention.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.intentions - -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiClass -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.psi.KtDotQualifiedExpression - -abstract class ConvertDotQualifiedToScopeIntention( - text: String -) : ConvertToScopeIntention(KtDotQualifiedExpression::class.java, text) { - - override val isParameterScopeFunction = false - - override fun isApplicableTo(element: KtDotQualifiedExpression, caretOffset: Int): Boolean { - val receiverExpression = element.getLeftMostReceiverExpression() - if (receiverExpression.mainReference?.resolve() is PsiClass) return false - val receiverExpressionText = receiverExpression.text - if (receiverExpressionText == scopeReceiverName) return false - if (!isApplicableWithGivenReceiverText(element, receiverExpressionText)) return false - val nextSibling = element.getDotQualifiedSiblingIfAny(forward = true) - if (nextSibling != null && isApplicableWithGivenReceiverText(nextSibling, receiverExpressionText)) return true - val prevSibling = element.getDotQualifiedSiblingIfAny(forward = false) - return prevSibling != null && isApplicableWithGivenReceiverText(prevSibling, receiverExpressionText) - } - - override fun applyTo(element: KtDotQualifiedExpression, editor: Editor?) { - val receiverExpressionText = element.getReceiverExpressionText() ?: return - applyWithGivenReceiverText(element, receiverExpressionText) - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToApplyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToApplyIntention.kt deleted file mode 100644 index 43e11fdc5ea..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToApplyIntention.kt +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.intentions - -import com.intellij.openapi.editor.Editor -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComments - -sealed class ConvertToApplyOrAlsoIntention(isAlso: Boolean) : ConvertToScopeIntention( - KtExpression::class.java, "Convert to ${scopeFunctionName(isAlso)}" -) { - - companion object { - fun scopeFunctionName(isParameterScopeFunction: Boolean) = if (isParameterScopeFunction) "also" else "apply" - } - - override val isParameterScopeFunction = isAlso - - override fun findCallExpressionFrom(scopeExpression: KtExpression) = - ((scopeExpression as? KtProperty)?.initializer as? KtQualifiedExpression)?.callExpression - - override fun isApplicableTo(element: KtExpression, caretOffset: Int): Boolean { - return when (element) { - is KtProperty -> element.isApplicable() - is KtDotQualifiedExpression -> { - val receiverExpressionText = element.getLeftMostReceiverExpression().text - isApplicableWithGivenReceiverText(element, receiverExpressionText) && - element.findTargetProperty(receiverExpressionText)?.isApplicable() ?: false - } - else -> false - } - } - - private fun KtProperty.isApplicable(): Boolean { - if (!isLocal) return false - val localVariableName = name ?: return false - val firstDotQualified = getDotQualifiedSiblingIfAny(forward = true) - if (firstDotQualified != null && isApplicableWithGivenReceiverText(firstDotQualified, localVariableName)) { - val nextDotQualified = firstDotQualified.getDotQualifiedSiblingIfAny(forward = true) - return nextDotQualified != null && isApplicableWithGivenReceiverText(nextDotQualified, localVariableName) - } - return false - } - - private fun KtDotQualifiedExpression.findTargetProperty(receiverExpressionText: String): KtProperty? { - val target = getPrevSiblingIgnoringWhitespaceAndComments(false) - when (target) { - is KtProperty -> - if (target.name == receiverExpressionText) { - return target - } - is KtDotQualifiedExpression -> - if (isApplicableWithGivenReceiverText(target, receiverExpressionText)) { - return target.findTargetProperty(receiverExpressionText) - } - } - return null - } - - override fun applyTo(element: KtExpression, editor: Editor?) { - when (element) { - is KtProperty -> applyWithGivenReceiverText(element, element.name ?: return) - is KtDotQualifiedExpression -> { - val receiverExpressionText = element.getReceiverExpressionText() ?: return - val property = element.findTargetProperty(receiverExpressionText) ?: return - applyWithGivenReceiverText(property, receiverExpressionText) - } - } - } - - override fun createScopeExpression(factory: KtPsiFactory, element: KtExpression): KtProperty? { - if (element !is KtProperty) return null - val receiverExpressionText = element.name ?: return null - return factory.createProperty(receiverExpressionText, element.typeReference?.text, element.isVar, - "${element.initializer?.text}.${scopeFunctionName(isParameterScopeFunction)}{}") - } -} - -class ConvertToApplyIntention : ConvertToApplyOrAlsoIntention(isAlso = false) - -class ConvertToAlsoIntention : ConvertToApplyOrAlsoIntention(isAlso = true) \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToRunIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToRunIntention.kt deleted file mode 100644 index 934b508a6a9..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToRunIntention.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.intentions - -import org.jetbrains.kotlin.psi.* - -class ConvertToRunIntention : ConvertDotQualifiedToScopeIntention("Convert to run") { - - override fun createScopeExpression(factory: KtPsiFactory, element: KtDotQualifiedExpression) = - factory.createExpressionByPattern("$0.run {}", element.getLeftMostReceiverExpression()) - - override fun findCallExpressionFrom(scopeExpression: KtExpression) = - (scopeExpression as? KtQualifiedExpression)?.callExpression -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt index 2ce17ef81bb..4dc8c11d722 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToScopeIntention.kt @@ -16,92 +16,150 @@ package org.jetbrains.kotlin.idea.intentions +import com.intellij.openapi.editor.Editor +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement +import com.intellij.psi.PsiWhiteSpace +import org.jetbrains.kotlin.idea.intentions.ConvertToScopeIntention.ScopeFunction.* +import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespaceAndComments -import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComments +import org.jetbrains.kotlin.psi.psiUtil.* -abstract class ConvertToScopeIntention( - elementType: Class, - text: String -) : SelfTargetingIntention(elementType, text) { +sealed class ConvertToScopeIntention( + private val scopeFunction: ScopeFunction +) : SelfTargetingIntention(KtExpression::class.java, "Convert to ${scopeFunction.functionName}") { - abstract val isParameterScopeFunction: Boolean + enum class ScopeFunction(val functionName: String, val isParameterScope: Boolean) { + ALSO(functionName = "also", isParameterScope = true), + APPLY(functionName = "apply", isParameterScope = false), + RUN(functionName = "run", isParameterScope = false), + WITH(functionName = "with", isParameterScope = false); - protected val scopeReceiverName: String - get() = if (isParameterScopeFunction) "it" else "this" - - protected abstract fun createScopeExpression(factory: KtPsiFactory, element: TExpression): KtExpression? - - protected abstract fun findCallExpressionFrom(scopeExpression: KtExpression): KtCallExpression? - - protected fun KtDotQualifiedExpression.getReceiverExpressionText(): String? = getLeftMostReceiverExpression().text - - protected fun isApplicableWithGivenReceiverText(expression: KtDotQualifiedExpression, receiverExpressionText: String): Boolean { - if (receiverExpressionText != expression.getReceiverExpressionText()) return false - val callExpression = expression.callExpression ?: return false - if (!callExpression.isApplicable()) return false - val receiverExpression = expression.receiverExpression - return receiverExpression !is KtDotQualifiedExpression || - isApplicableWithGivenReceiverText(receiverExpression, receiverExpressionText) + val receiver = if (isParameterScope) "it" else "this" } - protected fun applyWithGivenReceiverText(expression: TExpression, receiverExpressionText: String) { - val factory = KtPsiFactory(expression) - val scopeBlockExpression = createScopeExpression(factory, expression) ?: return - val callExpression = findCallExpressionFrom(scopeBlockExpression) ?: return - val blockExpression = callExpression.getFirstLambdaArgumentBody() ?: return - val parent = expression.parent - val lastExpressionToMove = findLastExpressionToMove(receiverExpressionText, expression) - val firstTargetExpression = - if (expression is KtProperty) expression - else findFirstExpressionToMove(receiverExpressionText, expression) - val firstExpressionToMove = if (expression is KtProperty) expression.nextSibling else firstTargetExpression - blockExpression.moveRangeInto(firstExpressionToMove, lastExpressionToMove, factory) - - parent.addBefore(scopeBlockExpression, firstTargetExpression) - parent.deleteChildRange(firstTargetExpression, lastExpressionToMove) - } - - protected fun KtExpression.getDotQualifiedSiblingIfAny(forward: Boolean): KtDotQualifiedExpression? { - val sibling = - if (forward) getNextSiblingIgnoringWhitespaceAndComments(false) - else getPrevSiblingIgnoringWhitespaceAndComments(false) - return sibling as? KtDotQualifiedExpression - } - - private fun KtCallExpression.getFirstLambdaArgumentBody() = - lambdaArguments.firstOrNull()?.getLambdaExpression()?.bodyExpression - - private fun KtBlockExpression.moveRangeInto( - firstElement: PsiElement, lastElement: PsiElement, psiFactory: KtPsiFactory - ) { - addRange(firstElement, lastElement) - children.filterIsInstance(KtDotQualifiedExpression::class.java) - .forEach { - val replaced = it.deleteFirstReceiver() - if (isParameterScopeFunction) { - replaced.replace(psiFactory.createExpressionByPattern("$scopeReceiverName.$0", replaced)) - } - } - } - - private fun KtCallExpression.isApplicable() = lambdaArguments.isEmpty() && valueArguments.all { it.text != scopeReceiverName } - - private fun findFirstExpressionToMove(receiverExpressionText: String, expression: KtExpression) = - findBoundaryExpression(receiverExpressionText, expression, forward = false) - - private fun findLastExpressionToMove(receiverExpressionText: String, expression: KtExpression) = - findBoundaryExpression(receiverExpressionText, expression, forward = true) - - private fun findBoundaryExpression(receiverExpressionText: String, expression: KtExpression, forward: Boolean): KtExpression { - var targetExpression: KtExpression = expression - while (true) { - val dotQualifiedSibling = targetExpression.getDotQualifiedSiblingIfAny(forward) - if (dotQualifiedSibling == null || !isApplicableWithGivenReceiverText(dotQualifiedSibling, receiverExpressionText)) { - return targetExpression + override fun isApplicableTo(element: KtExpression, caretOffset: Int): Boolean { + when (element) { + is KtProperty -> + if (!element.isLocal) return false + is KtDotQualifiedExpression -> { + if (element.parent is KtDotQualifiedExpression) return false + val name = element.getLeftMostReceiverExpression().text + if (!element.isTarget(name)) return false } - targetExpression = dotQualifiedSibling + else -> + return false } + return element.collectTargetElements() != null } -} \ No newline at end of file + + override fun applyTo(element: KtExpression, editor: Editor?) { + val targets = element.collectTargetElements() ?: return + val first = targets.firstOrNull() ?: return + val last = targets.lastOrNull() ?: return + val property = element.prevProperty() + val propertyOrFirst = when (scopeFunction) { + ALSO, APPLY -> property + else -> first + } ?: return + val parent = element.parent + + val psiFactory = KtPsiFactory(element) + val (scopeFunctionCall, block) = psiFactory.createScopeFunctionCall(propertyOrFirst) ?: return + block.addRange(property?.nextSibling ?: first, last) + block.children.filterIsInstance(KtDotQualifiedExpression::class.java) + .forEach { + val replaced = it.deleteFirstReceiver() + if (scopeFunction.isParameterScope) { + replaced.replace(psiFactory.createExpressionByPattern("${scopeFunction.receiver}.$0", replaced)) + } + } + parent.addBefore(scopeFunctionCall, propertyOrFirst) + parent.deleteChildRange(propertyOrFirst, last) + } + + private fun KtExpression.collectTargetElements(): List? { + val targets = when (scopeFunction) { + ALSO, APPLY -> { + val property = prevProperty() ?: return null + val referenceName = property.name ?: return null + property.collectTargetElements(referenceName, forward = true).toList().takeIf { this is KtProperty || this in it } + } + else -> { + if (this !is KtDotQualifiedExpression) return null + val referenceName = getLeftMostReceiverExpression().text + val prev = collectTargetElements(referenceName, forward = false).toList().reversed() + val next = collectTargetElements(referenceName, forward = true) + prev + listOf(this) + next + } + } + return targets?.takeIf { it.size >= 2 } + } + + private fun KtExpression.collectTargetElements(referenceName: String, forward: Boolean): Sequence { + return siblings(forward, withItself = false) + .filter { it !is PsiWhiteSpace && it !is PsiComment } + .takeWhile { it.isTarget(referenceName) } + } + + private fun PsiElement.isTarget(referenceName: String): Boolean { + if (this !is KtDotQualifiedExpression) return false + val leftMostReceiver = getLeftMostReceiverExpression() + if (leftMostReceiver.text != referenceName) return false + if (leftMostReceiver.mainReference?.resolve() is PsiClass) return false + val callExpr = callExpression ?: return false + if (callExpr.lambdaArguments.isNotEmpty() || callExpr.valueArguments.any { it.text == scopeFunction.receiver }) return false + return !anyDescendantOfType { it.text == scopeFunction.receiver } + } + + private fun KtExpression.prevProperty(): KtProperty? { + return siblings(forward = false, withItself = true).firstOrNull { it is KtProperty && it.isLocal } as? KtProperty + } + + private fun KtPsiFactory.createScopeFunctionCall(element: PsiElement): Pair? { + val scopeFunctionName = scopeFunction.functionName + val (scopeFunctionCall, callExpression) = when (scopeFunction) { + ALSO, APPLY -> { + if (element !is KtProperty) return null + val propertyName = element.name ?: return null + val initializer = element.initializer ?: return null + val property = createProperty( + name = propertyName, + type = element.typeReference?.text, + isVar = element.isVar, + initializer = "${initializer.text}.$scopeFunctionName {}" + ) + val callExpression = (property.initializer as? KtDotQualifiedExpression)?.callExpression ?: return null + property to callExpression + } + RUN -> { + if (element !is KtDotQualifiedExpression) return null + val scopeFunctionCall = createExpressionByPattern( + "$0.$scopeFunctionName {}", + element.getLeftMostReceiverExpression() + ) as? KtQualifiedExpression ?: return null + val callExpression = scopeFunctionCall.callExpression ?: return null + scopeFunctionCall to callExpression + } + WITH -> { + if (element !is KtDotQualifiedExpression) return null + val scopeFunctionCall = createExpressionByPattern( + "$scopeFunctionName($0) {}", + element.getLeftMostReceiverExpression() + ) as? KtCallExpression ?: return null + scopeFunctionCall to scopeFunctionCall + } + } + val body = callExpression.lambdaArguments.firstOrNull()?.getLambdaExpression()?.bodyExpression ?: return null + return scopeFunctionCall to body + } +} + +class ConvertToAlsoIntention : ConvertToScopeIntention(ALSO) + +class ConvertToApplyIntention : ConvertToScopeIntention(APPLY) + +class ConvertToRunIntention : ConvertToScopeIntention(RUN) + +class ConvertToWithIntention : ConvertToScopeIntention(WITH) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToWithIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToWithIntention.kt deleted file mode 100644 index c287f3ea0d8..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertToWithIntention.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.intentions - -import org.jetbrains.kotlin.psi.* - -class ConvertToWithIntention : ConvertDotQualifiedToScopeIntention("Convert to with") { - - override fun createScopeExpression(factory: KtPsiFactory, element: KtDotQualifiedExpression) = - factory.createExpressionByPattern("with($0) {}", element.getLeftMostReceiverExpression()) - - override fun findCallExpressionFrom(scopeExpression: KtExpression) = scopeExpression as? KtCallExpression -} \ No newline at end of file diff --git a/idea/testData/intentions/convertToAlso/.intention b/idea/testData/intentions/convertToScope/convertToAlso/.intention similarity index 100% rename from idea/testData/intentions/convertToAlso/.intention rename to idea/testData/intentions/convertToScope/convertToAlso/.intention diff --git a/idea/testData/intentions/convertToAlso/itParameter.kt b/idea/testData/intentions/convertToScope/convertToAlso/itParameter.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/itParameter.kt rename to idea/testData/intentions/convertToScope/convertToAlso/itParameter.kt diff --git a/idea/testData/intentions/convertToAlso/itParameter2.kt b/idea/testData/intentions/convertToScope/convertToAlso/itParameter2.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/itParameter2.kt rename to idea/testData/intentions/convertToScope/convertToAlso/itParameter2.kt diff --git a/idea/testData/intentions/convertToAlso/methodChain.kt b/idea/testData/intentions/convertToScope/convertToAlso/methodChain.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/methodChain.kt rename to idea/testData/intentions/convertToScope/convertToAlso/methodChain.kt diff --git a/idea/testData/intentions/convertToAlso/methodChain.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/methodChain.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/methodChain.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/methodChain.kt.after diff --git a/idea/testData/intentions/convertToAlso/methodChainWithItParameter.kt b/idea/testData/intentions/convertToScope/convertToAlso/methodChainWithItParameter.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/methodChainWithItParameter.kt rename to idea/testData/intentions/convertToScope/convertToAlso/methodChainWithItParameter.kt diff --git a/idea/testData/intentions/convertToAlso/methodChainWithThisParameter.kt b/idea/testData/intentions/convertToScope/convertToAlso/methodChainWithThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/methodChainWithThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToAlso/methodChainWithThisParameter.kt diff --git a/idea/testData/intentions/convertToAlso/methodChainWithThisParameter.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/methodChainWithThisParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/methodChainWithThisParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/methodChainWithThisParameter.kt.after diff --git a/idea/testData/intentions/convertToAlso/normal.kt b/idea/testData/intentions/convertToScope/convertToAlso/normal.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/normal.kt rename to idea/testData/intentions/convertToScope/convertToAlso/normal.kt diff --git a/idea/testData/intentions/convertToAlso/normal.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/normal.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/normal.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/normal.kt.after diff --git a/idea/testData/intentions/convertToAlso/normal2.kt b/idea/testData/intentions/convertToScope/convertToAlso/normal2.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/normal2.kt rename to idea/testData/intentions/convertToScope/convertToAlso/normal2.kt diff --git a/idea/testData/intentions/convertToAlso/normal2.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/normal2.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/normal2.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/normal2.kt.after diff --git a/idea/testData/intentions/convertToAlso/normal3.kt b/idea/testData/intentions/convertToScope/convertToAlso/normal3.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/normal3.kt rename to idea/testData/intentions/convertToScope/convertToAlso/normal3.kt diff --git a/idea/testData/intentions/convertToAlso/normal3.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/normal3.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/normal3.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/normal3.kt.after diff --git a/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt b/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt new file mode 100644 index 00000000000..f6d48507ab3 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt.after new file mode 100644 index 00000000000..06cbd7d6948 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt.after @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass().also { + it.foo1() + it.foo2() + it.foo3() + } + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToAlso/untilItParameter.kt b/idea/testData/intentions/convertToScope/convertToAlso/untilItParameter.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/untilItParameter.kt rename to idea/testData/intentions/convertToScope/convertToAlso/untilItParameter.kt diff --git a/idea/testData/intentions/convertToAlso/untilItParameter.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/untilItParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/untilItParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/untilItParameter.kt.after diff --git a/idea/testData/intentions/convertToAlso/var.kt b/idea/testData/intentions/convertToScope/convertToAlso/var.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/var.kt rename to idea/testData/intentions/convertToScope/convertToAlso/var.kt diff --git a/idea/testData/intentions/convertToAlso/var.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/var.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/var.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/var.kt.after diff --git a/idea/testData/intentions/convertToAlso/withCommentAndSpaces.kt b/idea/testData/intentions/convertToScope/convertToAlso/withCommentAndSpaces.kt similarity index 100% rename from idea/testData/intentions/convertToAlso/withCommentAndSpaces.kt rename to idea/testData/intentions/convertToScope/convertToAlso/withCommentAndSpaces.kt diff --git a/idea/testData/intentions/convertToAlso/withCommentAndSpaces.kt.after b/idea/testData/intentions/convertToScope/convertToAlso/withCommentAndSpaces.kt.after similarity index 100% rename from idea/testData/intentions/convertToAlso/withCommentAndSpaces.kt.after rename to idea/testData/intentions/convertToScope/convertToAlso/withCommentAndSpaces.kt.after diff --git a/idea/testData/intentions/convertToApply/.intention b/idea/testData/intentions/convertToScope/convertToApply/.intention similarity index 100% rename from idea/testData/intentions/convertToApply/.intention rename to idea/testData/intentions/convertToScope/convertToApply/.intention diff --git a/idea/testData/intentions/convertToApply/methodChain.kt b/idea/testData/intentions/convertToScope/convertToApply/methodChain.kt similarity index 100% rename from idea/testData/intentions/convertToApply/methodChain.kt rename to idea/testData/intentions/convertToScope/convertToApply/methodChain.kt diff --git a/idea/testData/intentions/convertToApply/methodChain.kt.after b/idea/testData/intentions/convertToScope/convertToApply/methodChain.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/methodChain.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/methodChain.kt.after diff --git a/idea/testData/intentions/convertToApply/methodChainWithItParameter.kt b/idea/testData/intentions/convertToScope/convertToApply/methodChainWithItParameter.kt similarity index 100% rename from idea/testData/intentions/convertToApply/methodChainWithItParameter.kt rename to idea/testData/intentions/convertToScope/convertToApply/methodChainWithItParameter.kt diff --git a/idea/testData/intentions/convertToApply/methodChainWithItParameter.kt.after b/idea/testData/intentions/convertToScope/convertToApply/methodChainWithItParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/methodChainWithItParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/methodChainWithItParameter.kt.after diff --git a/idea/testData/intentions/convertToApply/methodChainWithThisParameter.kt b/idea/testData/intentions/convertToScope/convertToApply/methodChainWithThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToApply/methodChainWithThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToApply/methodChainWithThisParameter.kt diff --git a/idea/testData/intentions/convertToApply/normal.kt b/idea/testData/intentions/convertToScope/convertToApply/normal.kt similarity index 100% rename from idea/testData/intentions/convertToApply/normal.kt rename to idea/testData/intentions/convertToScope/convertToApply/normal.kt diff --git a/idea/testData/intentions/convertToApply/normal.kt.after b/idea/testData/intentions/convertToScope/convertToApply/normal.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/normal.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/normal.kt.after diff --git a/idea/testData/intentions/convertToApply/normal2.kt b/idea/testData/intentions/convertToScope/convertToApply/normal2.kt similarity index 100% rename from idea/testData/intentions/convertToApply/normal2.kt rename to idea/testData/intentions/convertToScope/convertToApply/normal2.kt diff --git a/idea/testData/intentions/convertToApply/normal2.kt.after b/idea/testData/intentions/convertToScope/convertToApply/normal2.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/normal2.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/normal2.kt.after diff --git a/idea/testData/intentions/convertToApply/normal3.kt b/idea/testData/intentions/convertToScope/convertToApply/normal3.kt similarity index 100% rename from idea/testData/intentions/convertToApply/normal3.kt rename to idea/testData/intentions/convertToScope/convertToApply/normal3.kt diff --git a/idea/testData/intentions/convertToApply/normal3.kt.after b/idea/testData/intentions/convertToScope/convertToApply/normal3.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/normal3.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/normal3.kt.after diff --git a/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt b/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt new file mode 100644 index 00000000000..f6d48507ab3 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt.after b/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt.after new file mode 100644 index 00000000000..4a692907b17 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToApply/onProperty.kt.after @@ -0,0 +1,15 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass().apply { + foo1() + foo2() + foo3() + } + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToApply/thisParameter.kt b/idea/testData/intentions/convertToScope/convertToApply/thisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToApply/thisParameter.kt rename to idea/testData/intentions/convertToScope/convertToApply/thisParameter.kt diff --git a/idea/testData/intentions/convertToApply/thisParameter2.kt b/idea/testData/intentions/convertToScope/convertToApply/thisParameter2.kt similarity index 100% rename from idea/testData/intentions/convertToApply/thisParameter2.kt rename to idea/testData/intentions/convertToScope/convertToApply/thisParameter2.kt diff --git a/idea/testData/intentions/convertToApply/untilThisParameter.kt b/idea/testData/intentions/convertToScope/convertToApply/untilThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToApply/untilThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToApply/untilThisParameter.kt diff --git a/idea/testData/intentions/convertToApply/untilThisParameter.kt.after b/idea/testData/intentions/convertToScope/convertToApply/untilThisParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/untilThisParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/untilThisParameter.kt.after diff --git a/idea/testData/intentions/convertToApply/var.kt b/idea/testData/intentions/convertToScope/convertToApply/var.kt similarity index 100% rename from idea/testData/intentions/convertToApply/var.kt rename to idea/testData/intentions/convertToScope/convertToApply/var.kt diff --git a/idea/testData/intentions/convertToApply/var.kt.after b/idea/testData/intentions/convertToScope/convertToApply/var.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/var.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/var.kt.after diff --git a/idea/testData/intentions/convertToApply/withCommentAndSpaces.kt b/idea/testData/intentions/convertToScope/convertToApply/withCommentAndSpaces.kt similarity index 100% rename from idea/testData/intentions/convertToApply/withCommentAndSpaces.kt rename to idea/testData/intentions/convertToScope/convertToApply/withCommentAndSpaces.kt diff --git a/idea/testData/intentions/convertToApply/withCommentAndSpaces.kt.after b/idea/testData/intentions/convertToScope/convertToApply/withCommentAndSpaces.kt.after similarity index 100% rename from idea/testData/intentions/convertToApply/withCommentAndSpaces.kt.after rename to idea/testData/intentions/convertToScope/convertToApply/withCommentAndSpaces.kt.after diff --git a/idea/testData/intentions/convertToRun/.intention b/idea/testData/intentions/convertToScope/convertToRun/.intention similarity index 100% rename from idea/testData/intentions/convertToRun/.intention rename to idea/testData/intentions/convertToScope/convertToRun/.intention diff --git a/idea/testData/intentions/convertToRun/itReceiver.kt b/idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt similarity index 100% rename from idea/testData/intentions/convertToRun/itReceiver.kt rename to idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt diff --git a/idea/testData/intentions/convertToRun/itReceiver.kt.after b/idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/itReceiver.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt.after diff --git a/idea/testData/intentions/convertToRun/javaMethod.1.java b/idea/testData/intentions/convertToScope/convertToRun/javaMethod.1.java similarity index 100% rename from idea/testData/intentions/convertToRun/javaMethod.1.java rename to idea/testData/intentions/convertToScope/convertToRun/javaMethod.1.java diff --git a/idea/testData/intentions/convertToRun/javaMethod.1.java.after b/idea/testData/intentions/convertToScope/convertToRun/javaMethod.1.java.after similarity index 100% rename from idea/testData/intentions/convertToRun/javaMethod.1.java.after rename to idea/testData/intentions/convertToScope/convertToRun/javaMethod.1.java.after diff --git a/idea/testData/intentions/convertToRun/javaMethod.kt b/idea/testData/intentions/convertToScope/convertToRun/javaMethod.kt similarity index 100% rename from idea/testData/intentions/convertToRun/javaMethod.kt rename to idea/testData/intentions/convertToScope/convertToRun/javaMethod.kt diff --git a/idea/testData/intentions/convertToRun/javaMethod.kt.after b/idea/testData/intentions/convertToScope/convertToRun/javaMethod.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/javaMethod.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/javaMethod.kt.after diff --git a/idea/testData/intentions/convertToRun/javaStaticMethod.1.java b/idea/testData/intentions/convertToScope/convertToRun/javaStaticMethod.1.java similarity index 100% rename from idea/testData/intentions/convertToRun/javaStaticMethod.1.java rename to idea/testData/intentions/convertToScope/convertToRun/javaStaticMethod.1.java diff --git a/idea/testData/intentions/convertToRun/javaStaticMethod.kt b/idea/testData/intentions/convertToScope/convertToRun/javaStaticMethod.kt similarity index 100% rename from idea/testData/intentions/convertToRun/javaStaticMethod.kt rename to idea/testData/intentions/convertToScope/convertToRun/javaStaticMethod.kt diff --git a/idea/testData/intentions/convertToRun/methodChain.kt b/idea/testData/intentions/convertToScope/convertToRun/methodChain.kt similarity index 100% rename from idea/testData/intentions/convertToRun/methodChain.kt rename to idea/testData/intentions/convertToScope/convertToRun/methodChain.kt diff --git a/idea/testData/intentions/convertToRun/methodChain.kt.after b/idea/testData/intentions/convertToScope/convertToRun/methodChain.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/methodChain.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/methodChain.kt.after diff --git a/idea/testData/intentions/convertToRun/methodChainWithItParameter.kt b/idea/testData/intentions/convertToScope/convertToRun/methodChainWithItParameter.kt similarity index 100% rename from idea/testData/intentions/convertToRun/methodChainWithItParameter.kt rename to idea/testData/intentions/convertToScope/convertToRun/methodChainWithItParameter.kt diff --git a/idea/testData/intentions/convertToRun/methodChainWithItParameter.kt.after b/idea/testData/intentions/convertToScope/convertToRun/methodChainWithItParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/methodChainWithItParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/methodChainWithItParameter.kt.after diff --git a/idea/testData/intentions/convertToRun/methodChainWithThisParameter.kt b/idea/testData/intentions/convertToScope/convertToRun/methodChainWithThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToRun/methodChainWithThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToRun/methodChainWithThisParameter.kt diff --git a/idea/testData/intentions/convertToRun/normal.kt b/idea/testData/intentions/convertToScope/convertToRun/normal.kt similarity index 100% rename from idea/testData/intentions/convertToRun/normal.kt rename to idea/testData/intentions/convertToScope/convertToRun/normal.kt diff --git a/idea/testData/intentions/convertToRun/normal.kt.after b/idea/testData/intentions/convertToScope/convertToRun/normal.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/normal.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/normal.kt.after diff --git a/idea/testData/intentions/convertToRun/normal2.kt b/idea/testData/intentions/convertToScope/convertToRun/normal2.kt similarity index 100% rename from idea/testData/intentions/convertToRun/normal2.kt rename to idea/testData/intentions/convertToScope/convertToRun/normal2.kt diff --git a/idea/testData/intentions/convertToRun/normal2.kt.after b/idea/testData/intentions/convertToScope/convertToRun/normal2.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/normal2.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/normal2.kt.after diff --git a/idea/testData/intentions/convertToRun/normal3.kt b/idea/testData/intentions/convertToScope/convertToRun/normal3.kt similarity index 100% rename from idea/testData/intentions/convertToRun/normal3.kt rename to idea/testData/intentions/convertToScope/convertToRun/normal3.kt diff --git a/idea/testData/intentions/convertToRun/normal3.kt.after b/idea/testData/intentions/convertToScope/convertToRun/normal3.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/normal3.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/normal3.kt.after diff --git a/idea/testData/intentions/convertToScope/convertToRun/normal4.kt b/idea/testData/intentions/convertToScope/convertToRun/normal4.kt new file mode 100644 index 00000000000..3861e44ece4 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/normal4.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToRun/normal4.kt.after b/idea/testData/intentions/convertToScope/convertToRun/normal4.kt.after new file mode 100644 index 00000000000..18378ed0ee4 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/normal4.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.run { + foo1() + foo2() + foo3() + } + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToRun/onProperty.kt b/idea/testData/intentions/convertToScope/convertToRun/onProperty.kt new file mode 100644 index 00000000000..09ebe675abc --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToRun/onProperty.kt @@ -0,0 +1,14 @@ +// IS_APPLICABLE: false + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToRun/thisParameter.kt b/idea/testData/intentions/convertToScope/convertToRun/thisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToRun/thisParameter.kt rename to idea/testData/intentions/convertToScope/convertToRun/thisParameter.kt diff --git a/idea/testData/intentions/convertToRun/thisReceiver.kt b/idea/testData/intentions/convertToScope/convertToRun/thisReceiver.kt similarity index 100% rename from idea/testData/intentions/convertToRun/thisReceiver.kt rename to idea/testData/intentions/convertToScope/convertToRun/thisReceiver.kt diff --git a/idea/testData/intentions/convertToRun/untilThisParameter.kt b/idea/testData/intentions/convertToScope/convertToRun/untilThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToRun/untilThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToRun/untilThisParameter.kt diff --git a/idea/testData/intentions/convertToRun/untilThisParameter.kt.after b/idea/testData/intentions/convertToScope/convertToRun/untilThisParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/untilThisParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/untilThisParameter.kt.after diff --git a/idea/testData/intentions/convertToRun/withCommentAndSpaces.kt b/idea/testData/intentions/convertToScope/convertToRun/withCommentAndSpaces.kt similarity index 100% rename from idea/testData/intentions/convertToRun/withCommentAndSpaces.kt rename to idea/testData/intentions/convertToScope/convertToRun/withCommentAndSpaces.kt diff --git a/idea/testData/intentions/convertToRun/withCommentAndSpaces.kt.after b/idea/testData/intentions/convertToScope/convertToRun/withCommentAndSpaces.kt.after similarity index 100% rename from idea/testData/intentions/convertToRun/withCommentAndSpaces.kt.after rename to idea/testData/intentions/convertToScope/convertToRun/withCommentAndSpaces.kt.after diff --git a/idea/testData/intentions/convertToWith/.intention b/idea/testData/intentions/convertToScope/convertToWith/.intention similarity index 100% rename from idea/testData/intentions/convertToWith/.intention rename to idea/testData/intentions/convertToScope/convertToWith/.intention diff --git a/idea/testData/intentions/convertToWith/itReceiver.kt b/idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt similarity index 100% rename from idea/testData/intentions/convertToWith/itReceiver.kt rename to idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt diff --git a/idea/testData/intentions/convertToWith/itReceiver.kt.after b/idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/itReceiver.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt.after diff --git a/idea/testData/intentions/convertToWith/javaMethod.1.java b/idea/testData/intentions/convertToScope/convertToWith/javaMethod.1.java similarity index 100% rename from idea/testData/intentions/convertToWith/javaMethod.1.java rename to idea/testData/intentions/convertToScope/convertToWith/javaMethod.1.java diff --git a/idea/testData/intentions/convertToWith/javaMethod.1.java.after b/idea/testData/intentions/convertToScope/convertToWith/javaMethod.1.java.after similarity index 100% rename from idea/testData/intentions/convertToWith/javaMethod.1.java.after rename to idea/testData/intentions/convertToScope/convertToWith/javaMethod.1.java.after diff --git a/idea/testData/intentions/convertToWith/javaMethod.kt b/idea/testData/intentions/convertToScope/convertToWith/javaMethod.kt similarity index 100% rename from idea/testData/intentions/convertToWith/javaMethod.kt rename to idea/testData/intentions/convertToScope/convertToWith/javaMethod.kt diff --git a/idea/testData/intentions/convertToWith/javaMethod.kt.after b/idea/testData/intentions/convertToScope/convertToWith/javaMethod.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/javaMethod.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/javaMethod.kt.after diff --git a/idea/testData/intentions/convertToWith/javaStaticMethod.1.java b/idea/testData/intentions/convertToScope/convertToWith/javaStaticMethod.1.java similarity index 100% rename from idea/testData/intentions/convertToWith/javaStaticMethod.1.java rename to idea/testData/intentions/convertToScope/convertToWith/javaStaticMethod.1.java diff --git a/idea/testData/intentions/convertToWith/javaStaticMethod.kt b/idea/testData/intentions/convertToScope/convertToWith/javaStaticMethod.kt similarity index 100% rename from idea/testData/intentions/convertToWith/javaStaticMethod.kt rename to idea/testData/intentions/convertToScope/convertToWith/javaStaticMethod.kt diff --git a/idea/testData/intentions/convertToWith/methodChain.kt b/idea/testData/intentions/convertToScope/convertToWith/methodChain.kt similarity index 100% rename from idea/testData/intentions/convertToWith/methodChain.kt rename to idea/testData/intentions/convertToScope/convertToWith/methodChain.kt diff --git a/idea/testData/intentions/convertToWith/methodChain.kt.after b/idea/testData/intentions/convertToScope/convertToWith/methodChain.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/methodChain.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/methodChain.kt.after diff --git a/idea/testData/intentions/convertToWith/methodChainWithItParameter.kt b/idea/testData/intentions/convertToScope/convertToWith/methodChainWithItParameter.kt similarity index 100% rename from idea/testData/intentions/convertToWith/methodChainWithItParameter.kt rename to idea/testData/intentions/convertToScope/convertToWith/methodChainWithItParameter.kt diff --git a/idea/testData/intentions/convertToWith/methodChainWithItParameter.kt.after b/idea/testData/intentions/convertToScope/convertToWith/methodChainWithItParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/methodChainWithItParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/methodChainWithItParameter.kt.after diff --git a/idea/testData/intentions/convertToWith/methodChainWithThisParameter.kt b/idea/testData/intentions/convertToScope/convertToWith/methodChainWithThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToWith/methodChainWithThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToWith/methodChainWithThisParameter.kt diff --git a/idea/testData/intentions/convertToWith/normal.kt b/idea/testData/intentions/convertToScope/convertToWith/normal.kt similarity index 100% rename from idea/testData/intentions/convertToWith/normal.kt rename to idea/testData/intentions/convertToScope/convertToWith/normal.kt diff --git a/idea/testData/intentions/convertToWith/normal.kt.after b/idea/testData/intentions/convertToScope/convertToWith/normal.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/normal.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/normal.kt.after diff --git a/idea/testData/intentions/convertToWith/normal2.kt b/idea/testData/intentions/convertToScope/convertToWith/normal2.kt similarity index 100% rename from idea/testData/intentions/convertToWith/normal2.kt rename to idea/testData/intentions/convertToScope/convertToWith/normal2.kt diff --git a/idea/testData/intentions/convertToWith/normal2.kt.after b/idea/testData/intentions/convertToScope/convertToWith/normal2.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/normal2.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/normal2.kt.after diff --git a/idea/testData/intentions/convertToWith/normal3.kt b/idea/testData/intentions/convertToScope/convertToWith/normal3.kt similarity index 100% rename from idea/testData/intentions/convertToWith/normal3.kt rename to idea/testData/intentions/convertToScope/convertToWith/normal3.kt diff --git a/idea/testData/intentions/convertToWith/normal3.kt.after b/idea/testData/intentions/convertToScope/convertToWith/normal3.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/normal3.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/normal3.kt.after diff --git a/idea/testData/intentions/convertToScope/convertToWith/normal4.kt b/idea/testData/intentions/convertToScope/convertToWith/normal4.kt new file mode 100644 index 00000000000..3861e44ece4 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/normal4.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToWith/normal4.kt.after b/idea/testData/intentions/convertToScope/convertToWith/normal4.kt.after new file mode 100644 index 00000000000..001569a5929 --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/normal4.kt.after @@ -0,0 +1,16 @@ +// WITH_RUNTIME + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + with(a) { + foo1() + foo2() + foo3() + } + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToScope/convertToWith/onProperty.kt b/idea/testData/intentions/convertToScope/convertToWith/onProperty.kt new file mode 100644 index 00000000000..09ebe675abc --- /dev/null +++ b/idea/testData/intentions/convertToScope/convertToWith/onProperty.kt @@ -0,0 +1,14 @@ +// IS_APPLICABLE: false + +class MyClass { + fun foo1() = Unit + fun foo2() = Unit + fun foo3() = Unit + + fun foo4() { + val a = MyClass() + a.foo1() + a.foo2() + a.foo3() + } +} \ No newline at end of file diff --git a/idea/testData/intentions/convertToWith/thisParameter.kt b/idea/testData/intentions/convertToScope/convertToWith/thisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToWith/thisParameter.kt rename to idea/testData/intentions/convertToScope/convertToWith/thisParameter.kt diff --git a/idea/testData/intentions/convertToWith/thisReceiver.kt b/idea/testData/intentions/convertToScope/convertToWith/thisReceiver.kt similarity index 100% rename from idea/testData/intentions/convertToWith/thisReceiver.kt rename to idea/testData/intentions/convertToScope/convertToWith/thisReceiver.kt diff --git a/idea/testData/intentions/convertToWith/untilThisParameter.kt b/idea/testData/intentions/convertToScope/convertToWith/untilThisParameter.kt similarity index 100% rename from idea/testData/intentions/convertToWith/untilThisParameter.kt rename to idea/testData/intentions/convertToScope/convertToWith/untilThisParameter.kt diff --git a/idea/testData/intentions/convertToWith/untilThisParameter.kt.after b/idea/testData/intentions/convertToScope/convertToWith/untilThisParameter.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/untilThisParameter.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/untilThisParameter.kt.after diff --git a/idea/testData/intentions/convertToWith/withCommentAndSpaces.kt b/idea/testData/intentions/convertToScope/convertToWith/withCommentAndSpaces.kt similarity index 100% rename from idea/testData/intentions/convertToWith/withCommentAndSpaces.kt rename to idea/testData/intentions/convertToScope/convertToWith/withCommentAndSpaces.kt diff --git a/idea/testData/intentions/convertToWith/withCommentAndSpaces.kt.after b/idea/testData/intentions/convertToScope/convertToWith/withCommentAndSpaces.kt.after similarity index 100% rename from idea/testData/intentions/convertToWith/withCommentAndSpaces.kt.after rename to idea/testData/intentions/convertToScope/convertToWith/withCommentAndSpaces.kt.after diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index febfb26c42f..6519aad3dc7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7042,142 +7042,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/convertToAlso") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ConvertToAlso extends AbstractIntentionTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInConvertToAlso() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToAlso"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("itParameter.kt") - public void testItParameter() throws Exception { - runTest("idea/testData/intentions/convertToAlso/itParameter.kt"); - } - - @TestMetadata("itParameter2.kt") - public void testItParameter2() throws Exception { - runTest("idea/testData/intentions/convertToAlso/itParameter2.kt"); - } - - @TestMetadata("methodChain.kt") - public void testMethodChain() throws Exception { - runTest("idea/testData/intentions/convertToAlso/methodChain.kt"); - } - - @TestMetadata("methodChainWithItParameter.kt") - public void testMethodChainWithItParameter() throws Exception { - runTest("idea/testData/intentions/convertToAlso/methodChainWithItParameter.kt"); - } - - @TestMetadata("methodChainWithThisParameter.kt") - public void testMethodChainWithThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToAlso/methodChainWithThisParameter.kt"); - } - - @TestMetadata("normal.kt") - public void testNormal() throws Exception { - runTest("idea/testData/intentions/convertToAlso/normal.kt"); - } - - @TestMetadata("normal2.kt") - public void testNormal2() throws Exception { - runTest("idea/testData/intentions/convertToAlso/normal2.kt"); - } - - @TestMetadata("normal3.kt") - public void testNormal3() throws Exception { - runTest("idea/testData/intentions/convertToAlso/normal3.kt"); - } - - @TestMetadata("untilItParameter.kt") - public void testUntilItParameter() throws Exception { - runTest("idea/testData/intentions/convertToAlso/untilItParameter.kt"); - } - - @TestMetadata("var.kt") - public void testVar() throws Exception { - runTest("idea/testData/intentions/convertToAlso/var.kt"); - } - - @TestMetadata("withCommentAndSpaces.kt") - public void testWithCommentAndSpaces() throws Exception { - runTest("idea/testData/intentions/convertToAlso/withCommentAndSpaces.kt"); - } - } - - @TestMetadata("idea/testData/intentions/convertToApply") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ConvertToApply extends AbstractIntentionTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInConvertToApply() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToApply"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("methodChain.kt") - public void testMethodChain() throws Exception { - runTest("idea/testData/intentions/convertToApply/methodChain.kt"); - } - - @TestMetadata("methodChainWithItParameter.kt") - public void testMethodChainWithItParameter() throws Exception { - runTest("idea/testData/intentions/convertToApply/methodChainWithItParameter.kt"); - } - - @TestMetadata("methodChainWithThisParameter.kt") - public void testMethodChainWithThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToApply/methodChainWithThisParameter.kt"); - } - - @TestMetadata("normal.kt") - public void testNormal() throws Exception { - runTest("idea/testData/intentions/convertToApply/normal.kt"); - } - - @TestMetadata("normal2.kt") - public void testNormal2() throws Exception { - runTest("idea/testData/intentions/convertToApply/normal2.kt"); - } - - @TestMetadata("normal3.kt") - public void testNormal3() throws Exception { - runTest("idea/testData/intentions/convertToApply/normal3.kt"); - } - - @TestMetadata("thisParameter.kt") - public void testThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToApply/thisParameter.kt"); - } - - @TestMetadata("thisParameter2.kt") - public void testThisParameter2() throws Exception { - runTest("idea/testData/intentions/convertToApply/thisParameter2.kt"); - } - - @TestMetadata("untilThisParameter.kt") - public void testUntilThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToApply/untilThisParameter.kt"); - } - - @TestMetadata("var.kt") - public void testVar() throws Exception { - runTest("idea/testData/intentions/convertToApply/var.kt"); - } - - @TestMetadata("withCommentAndSpaces.kt") - public void testWithCommentAndSpaces() throws Exception { - runTest("idea/testData/intentions/convertToApply/withCommentAndSpaces.kt"); - } - } - @TestMetadata("idea/testData/intentions/convertToBlockBody") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -7570,81 +7434,338 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/convertToRun") + @TestMetadata("idea/testData/intentions/convertToScope") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class ConvertToRun extends AbstractIntentionTest { + public static class ConvertToScope extends AbstractIntentionTest { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - public void testAllFilesPresentInConvertToRun() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToRun"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + public void testAllFilesPresentInConvertToScope() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } - @TestMetadata("itReceiver.kt") - public void testItReceiver() throws Exception { - runTest("idea/testData/intentions/convertToRun/itReceiver.kt"); + @TestMetadata("idea/testData/intentions/convertToScope/convertToAlso") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertToAlso extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInConvertToAlso() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToAlso"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("itParameter.kt") + public void testItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/itParameter.kt"); + } + + @TestMetadata("itParameter2.kt") + public void testItParameter2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/itParameter2.kt"); + } + + @TestMetadata("methodChain.kt") + public void testMethodChain() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/methodChain.kt"); + } + + @TestMetadata("methodChainWithItParameter.kt") + public void testMethodChainWithItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/methodChainWithItParameter.kt"); + } + + @TestMetadata("methodChainWithThisParameter.kt") + public void testMethodChainWithThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/methodChainWithThisParameter.kt"); + } + + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/normal.kt"); + } + + @TestMetadata("normal2.kt") + public void testNormal2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/normal2.kt"); + } + + @TestMetadata("normal3.kt") + public void testNormal3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/normal3.kt"); + } + + @TestMetadata("onProperty.kt") + public void testOnProperty() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/onProperty.kt"); + } + + @TestMetadata("untilItParameter.kt") + public void testUntilItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/untilItParameter.kt"); + } + + @TestMetadata("var.kt") + public void testVar() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/var.kt"); + } + + @TestMetadata("withCommentAndSpaces.kt") + public void testWithCommentAndSpaces() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToAlso/withCommentAndSpaces.kt"); + } } - @TestMetadata("javaMethod.kt") - public void testJavaMethod() throws Exception { - runTest("idea/testData/intentions/convertToRun/javaMethod.kt"); + @TestMetadata("idea/testData/intentions/convertToScope/convertToApply") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertToApply extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInConvertToApply() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToApply"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("methodChain.kt") + public void testMethodChain() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/methodChain.kt"); + } + + @TestMetadata("methodChainWithItParameter.kt") + public void testMethodChainWithItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/methodChainWithItParameter.kt"); + } + + @TestMetadata("methodChainWithThisParameter.kt") + public void testMethodChainWithThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/methodChainWithThisParameter.kt"); + } + + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/normal.kt"); + } + + @TestMetadata("normal2.kt") + public void testNormal2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/normal2.kt"); + } + + @TestMetadata("normal3.kt") + public void testNormal3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/normal3.kt"); + } + + @TestMetadata("onProperty.kt") + public void testOnProperty() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/onProperty.kt"); + } + + @TestMetadata("thisParameter.kt") + public void testThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/thisParameter.kt"); + } + + @TestMetadata("thisParameter2.kt") + public void testThisParameter2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/thisParameter2.kt"); + } + + @TestMetadata("untilThisParameter.kt") + public void testUntilThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/untilThisParameter.kt"); + } + + @TestMetadata("var.kt") + public void testVar() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/var.kt"); + } + + @TestMetadata("withCommentAndSpaces.kt") + public void testWithCommentAndSpaces() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToApply/withCommentAndSpaces.kt"); + } } - @TestMetadata("javaStaticMethod.kt") - public void testJavaStaticMethod() throws Exception { - runTest("idea/testData/intentions/convertToRun/javaStaticMethod.kt"); + @TestMetadata("idea/testData/intentions/convertToScope/convertToRun") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertToRun extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInConvertToRun() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToRun"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("itReceiver.kt") + public void testItReceiver() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/itReceiver.kt"); + } + + @TestMetadata("javaMethod.kt") + public void testJavaMethod() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/javaMethod.kt"); + } + + @TestMetadata("javaStaticMethod.kt") + public void testJavaStaticMethod() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/javaStaticMethod.kt"); + } + + @TestMetadata("methodChain.kt") + public void testMethodChain() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/methodChain.kt"); + } + + @TestMetadata("methodChainWithItParameter.kt") + public void testMethodChainWithItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/methodChainWithItParameter.kt"); + } + + @TestMetadata("methodChainWithThisParameter.kt") + public void testMethodChainWithThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/methodChainWithThisParameter.kt"); + } + + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/normal.kt"); + } + + @TestMetadata("normal2.kt") + public void testNormal2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/normal2.kt"); + } + + @TestMetadata("normal3.kt") + public void testNormal3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/normal3.kt"); + } + + @TestMetadata("normal4.kt") + public void testNormal4() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/normal4.kt"); + } + + @TestMetadata("onProperty.kt") + public void testOnProperty() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/onProperty.kt"); + } + + @TestMetadata("thisParameter.kt") + public void testThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/thisParameter.kt"); + } + + @TestMetadata("thisReceiver.kt") + public void testThisReceiver() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/thisReceiver.kt"); + } + + @TestMetadata("untilThisParameter.kt") + public void testUntilThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/untilThisParameter.kt"); + } + + @TestMetadata("withCommentAndSpaces.kt") + public void testWithCommentAndSpaces() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToRun/withCommentAndSpaces.kt"); + } } - @TestMetadata("methodChain.kt") - public void testMethodChain() throws Exception { - runTest("idea/testData/intentions/convertToRun/methodChain.kt"); - } + @TestMetadata("idea/testData/intentions/convertToScope/convertToWith") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ConvertToWith extends AbstractIntentionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("methodChainWithItParameter.kt") - public void testMethodChainWithItParameter() throws Exception { - runTest("idea/testData/intentions/convertToRun/methodChainWithItParameter.kt"); - } + public void testAllFilesPresentInConvertToWith() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToScope/convertToWith"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } - @TestMetadata("methodChainWithThisParameter.kt") - public void testMethodChainWithThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToRun/methodChainWithThisParameter.kt"); - } + @TestMetadata("itReceiver.kt") + public void testItReceiver() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/itReceiver.kt"); + } - @TestMetadata("normal.kt") - public void testNormal() throws Exception { - runTest("idea/testData/intentions/convertToRun/normal.kt"); - } + @TestMetadata("javaMethod.kt") + public void testJavaMethod() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/javaMethod.kt"); + } - @TestMetadata("normal2.kt") - public void testNormal2() throws Exception { - runTest("idea/testData/intentions/convertToRun/normal2.kt"); - } + @TestMetadata("javaStaticMethod.kt") + public void testJavaStaticMethod() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/javaStaticMethod.kt"); + } - @TestMetadata("normal3.kt") - public void testNormal3() throws Exception { - runTest("idea/testData/intentions/convertToRun/normal3.kt"); - } + @TestMetadata("methodChain.kt") + public void testMethodChain() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/methodChain.kt"); + } - @TestMetadata("thisParameter.kt") - public void testThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToRun/thisParameter.kt"); - } + @TestMetadata("methodChainWithItParameter.kt") + public void testMethodChainWithItParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/methodChainWithItParameter.kt"); + } - @TestMetadata("thisReceiver.kt") - public void testThisReceiver() throws Exception { - runTest("idea/testData/intentions/convertToRun/thisReceiver.kt"); - } + @TestMetadata("methodChainWithThisParameter.kt") + public void testMethodChainWithThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/methodChainWithThisParameter.kt"); + } - @TestMetadata("untilThisParameter.kt") - public void testUntilThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToRun/untilThisParameter.kt"); - } + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/normal.kt"); + } - @TestMetadata("withCommentAndSpaces.kt") - public void testWithCommentAndSpaces() throws Exception { - runTest("idea/testData/intentions/convertToRun/withCommentAndSpaces.kt"); + @TestMetadata("normal2.kt") + public void testNormal2() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/normal2.kt"); + } + + @TestMetadata("normal3.kt") + public void testNormal3() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/normal3.kt"); + } + + @TestMetadata("normal4.kt") + public void testNormal4() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/normal4.kt"); + } + + @TestMetadata("onProperty.kt") + public void testOnProperty() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/onProperty.kt"); + } + + @TestMetadata("thisParameter.kt") + public void testThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/thisParameter.kt"); + } + + @TestMetadata("thisReceiver.kt") + public void testThisReceiver() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/thisReceiver.kt"); + } + + @TestMetadata("untilThisParameter.kt") + public void testUntilThisParameter() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/untilThisParameter.kt"); + } + + @TestMetadata("withCommentAndSpaces.kt") + public void testWithCommentAndSpaces() throws Exception { + runTest("idea/testData/intentions/convertToScope/convertToWith/withCommentAndSpaces.kt"); + } } } @@ -7909,84 +8030,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/convertToWith") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ConvertToWith extends AbstractIntentionTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInConvertToWith() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToWith"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("itReceiver.kt") - public void testItReceiver() throws Exception { - runTest("idea/testData/intentions/convertToWith/itReceiver.kt"); - } - - @TestMetadata("javaMethod.kt") - public void testJavaMethod() throws Exception { - runTest("idea/testData/intentions/convertToWith/javaMethod.kt"); - } - - @TestMetadata("javaStaticMethod.kt") - public void testJavaStaticMethod() throws Exception { - runTest("idea/testData/intentions/convertToWith/javaStaticMethod.kt"); - } - - @TestMetadata("methodChain.kt") - public void testMethodChain() throws Exception { - runTest("idea/testData/intentions/convertToWith/methodChain.kt"); - } - - @TestMetadata("methodChainWithItParameter.kt") - public void testMethodChainWithItParameter() throws Exception { - runTest("idea/testData/intentions/convertToWith/methodChainWithItParameter.kt"); - } - - @TestMetadata("methodChainWithThisParameter.kt") - public void testMethodChainWithThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToWith/methodChainWithThisParameter.kt"); - } - - @TestMetadata("normal.kt") - public void testNormal() throws Exception { - runTest("idea/testData/intentions/convertToWith/normal.kt"); - } - - @TestMetadata("normal2.kt") - public void testNormal2() throws Exception { - runTest("idea/testData/intentions/convertToWith/normal2.kt"); - } - - @TestMetadata("normal3.kt") - public void testNormal3() throws Exception { - runTest("idea/testData/intentions/convertToWith/normal3.kt"); - } - - @TestMetadata("thisParameter.kt") - public void testThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToWith/thisParameter.kt"); - } - - @TestMetadata("thisReceiver.kt") - public void testThisReceiver() throws Exception { - runTest("idea/testData/intentions/convertToWith/thisReceiver.kt"); - } - - @TestMetadata("untilThisParameter.kt") - public void testUntilThisParameter() throws Exception { - runTest("idea/testData/intentions/convertToWith/untilThisParameter.kt"); - } - - @TestMetadata("withCommentAndSpaces.kt") - public void testWithCommentAndSpaces() throws Exception { - runTest("idea/testData/intentions/convertToWith/withCommentAndSpaces.kt"); - } - } - @TestMetadata("idea/testData/intentions/convertTrimIndentToTrimMargin") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)