MoveLambdaOutsideParentheses: intention -> inspection #KT-21413 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
83573ed517
commit
decf9939fe
@@ -108,6 +108,13 @@ fun KtLambdaArgument.moveInsideParenthesesAndReplaceWith(
|
|||||||
return oldCallExpression.replace(newCallExpression) as KtCallExpression
|
return oldCallExpression.replace(newCallExpression) as KtCallExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun KtLambdaExpression.moveFunctionLiteralOutsideParenthesesIfPossible() {
|
||||||
|
val call = ((parent as? KtValueArgument)?.parent as? KtValueArgumentList)?.parent as? KtCallExpression ?: return
|
||||||
|
if (call.canMoveLambdaOutsideParentheses()) {
|
||||||
|
call.moveFunctionLiteralOutsideParentheses()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun shouldLambdaParameterBeNamed(args: List<ValueArgument>, callExpr: KtCallExpression): Boolean {
|
private fun shouldLambdaParameterBeNamed(args: List<ValueArgument>, callExpr: KtCallExpression): Boolean {
|
||||||
if (args.any { it.isNamed() }) return true
|
if (args.any { it.isNamed() }) return true
|
||||||
val calee = (callExpr.calleeExpression?.mainReference?.resolve() as? KtFunction) ?: return true
|
val calee = (callExpr.calleeExpression?.mainReference?.resolve() as? KtFunction) ?: return true
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
This inspection detects a lambda expression inside parentheses which can be moved outside of them.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
fun foo() {
|
|
||||||
<spot>bar(2) { it * 3 }</spot>
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
fun foo() {
|
|
||||||
<spot>bar(2, { it * 3 })</spot>
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
This intention moves a lambda expression outside parentheses.
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -973,11 +973,6 @@
|
|||||||
<category>Kotlin</category>
|
<category>Kotlin</category>
|
||||||
</intentionAction>
|
</intentionAction>
|
||||||
|
|
||||||
<intentionAction>
|
|
||||||
<className>org.jetbrains.kotlin.idea.intentions.MoveLambdaOutsideParenthesesIntention</className>
|
|
||||||
<category>Kotlin</category>
|
|
||||||
</intentionAction>
|
|
||||||
|
|
||||||
<intentionAction>
|
<intentionAction>
|
||||||
<className>org.jetbrains.kotlin.idea.intentions.declarations.SplitPropertyDeclarationIntention</className>
|
<className>org.jetbrains.kotlin.idea.intentions.declarations.SplitPropertyDeclarationIntention</className>
|
||||||
<category>Kotlin</category>
|
<category>Kotlin</category>
|
||||||
@@ -2774,6 +2769,15 @@
|
|||||||
language="kotlin"
|
language="kotlin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.MoveLambdaOutsideParenthesesInspection"
|
||||||
|
displayName="Lambda argument inside parentheses"
|
||||||
|
groupPath="Kotlin"
|
||||||
|
groupName="Style issues"
|
||||||
|
enabledByDefault="true"
|
||||||
|
level="WEAK WARNING"
|
||||||
|
language="kotlin"
|
||||||
|
/>
|
||||||
|
|
||||||
<referenceImporter implementation="org.jetbrains.kotlin.idea.quickfix.KotlinReferenceImporter"/>
|
<referenceImporter implementation="org.jetbrains.kotlin.idea.quickfix.KotlinReferenceImporter"/>
|
||||||
|
|
||||||
<fileType.fileViewProviderFactory filetype="KJSM" implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
|
<fileType.fileViewProviderFactory filetype="KJSM" implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.inspections
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.kotlin.idea.core.canMoveLambdaOutsideParentheses
|
||||||
|
import org.jetbrains.kotlin.idea.core.getLastLambdaExpression
|
||||||
|
import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParentheses
|
||||||
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||||
|
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||||
|
|
||||||
|
class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspection<KtCallExpression>(
|
||||||
|
KtCallExpression::class.java
|
||||||
|
) {
|
||||||
|
override fun isApplicable(element: KtCallExpression) = element.canMoveLambdaOutsideParentheses()
|
||||||
|
|
||||||
|
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
|
||||||
|
val expression = element.getParentOfType<KtCallExpression>(strict = false) ?: return
|
||||||
|
|
||||||
|
if (expression.canMoveLambdaOutsideParentheses()) {
|
||||||
|
expression.moveFunctionLiteralOutsideParentheses()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun inspectionText(element: KtCallExpression) = "Should be moved lambda argument out of parentheses"
|
||||||
|
|
||||||
|
override fun inspectionTarget(element: KtCallExpression): KtElement {
|
||||||
|
return element.getLastLambdaExpression()?.getStrictParentOfType<KtValueArgument>()?.asElement() ?: element
|
||||||
|
}
|
||||||
|
|
||||||
|
override val defaultFixText = "Move lambda argument out of parentheses"
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.search.LocalSearchScope
|
import com.intellij.psi.search.LocalSearchScope
|
||||||
import com.intellij.psi.search.searches.ReferencesSearch
|
import com.intellij.psi.search.searches.ReferencesSearch
|
||||||
|
import org.jetbrains.kotlin.idea.core.getLastLambdaExpression
|
||||||
|
import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParenthesesIfPossible
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
import org.jetbrains.kotlin.idea.core.replaced
|
||||||
import org.jetbrains.kotlin.idea.util.CommentSaver
|
import org.jetbrains.kotlin.idea.util.CommentSaver
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
@@ -89,9 +91,6 @@ class AnonymousFunctionToLambdaIntention : SelfTargetingRangeIntention<KtNamedFu
|
|||||||
val returnLabel = callee.getReferencedNameAsName()
|
val returnLabel = callee.getReferencedNameAsName()
|
||||||
returnSaver.restore(replaced, returnLabel)
|
returnSaver.restore(replaced, returnLabel)
|
||||||
|
|
||||||
val moveLambdaOutsideParenthesesIntention = MoveLambdaOutsideParenthesesIntention()
|
callExpression.getLastLambdaExpression()?.moveFunctionLiteralOutsideParenthesesIfPossible()
|
||||||
if (moveLambdaOutsideParenthesesIntention.isApplicableTo(callExpression, replaced.textOffset)) {
|
|
||||||
moveLambdaOutsideParenthesesIntention.applyTo(callExpression, editor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -97,7 +97,7 @@ class ConvertFunctionTypeParameterToReceiverIntention : SelfTargetingRangeIntent
|
|||||||
"$receiver.${expression.text}(${arguments.joinToString()})"
|
"$receiver.${expression.text}(${arguments.joinToString()})"
|
||||||
)
|
)
|
||||||
expression.replaced(adapterLambda).let {
|
expression.replaced(adapterLambda).let {
|
||||||
MoveLambdaOutsideParenthesesIntention.moveFunctionLiteralOutsideParenthesesIfPossible(it)
|
it.moveFunctionLiteralOutsideParenthesesIfPossible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ class ConvertFunctionTypeParameterToReceiverIntention : SelfTargetingRangeIntent
|
|||||||
} as KtLambdaExpression
|
} as KtLambdaExpression
|
||||||
|
|
||||||
expression.replaced(replacingLambda).let {
|
expression.replaced(replacingLambda).let {
|
||||||
MoveLambdaOutsideParenthesesIntention.moveFunctionLiteralOutsideParenthesesIfPossible(it)
|
it.moveFunctionLiteralOutsideParenthesesIfPossible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,10 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester
|
import org.jetbrains.kotlin.idea.core.*
|
||||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
|
||||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext.DOUBLE_COLON_LHS
|
import org.jetbrains.kotlin.resolve.BindingContext.DOUBLE_COLON_LHS
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext.REFERENCE_TARGET
|
import org.jetbrains.kotlin.resolve.BindingContext.REFERENCE_TARGET
|
||||||
@@ -123,10 +120,7 @@ class ConvertReferenceToLambdaIntention : SelfTargetingOffsetIndependentIntentio
|
|||||||
ShortenReferences.DEFAULT.process(element.replaced(wrappedExpression))
|
ShortenReferences.DEFAULT.process(element.replaced(wrappedExpression))
|
||||||
|
|
||||||
if (valueArgumentParent != null && callGrandParent != null) {
|
if (valueArgumentParent != null && callGrandParent != null) {
|
||||||
val moveOutOfParenthesis = MoveLambdaOutsideParenthesesIntention()
|
callGrandParent.getLastLambdaExpression()?.moveFunctionLiteralOutsideParenthesesIfPossible()
|
||||||
if (moveOutOfParenthesis.isApplicableTo(callGrandParent, valueArgumentParent.startOffset)) {
|
|
||||||
moveOutOfParenthesis.applyTo(callGrandParent, editor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-54
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2015 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.idea.core.canMoveLambdaOutsideParentheses
|
|
||||||
import org.jetbrains.kotlin.idea.core.getLastLambdaExpression
|
|
||||||
import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParentheses
|
|
||||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
|
||||||
import org.jetbrains.kotlin.psi.KtLambdaExpression
|
|
||||||
import org.jetbrains.kotlin.psi.KtValueArgument
|
|
||||||
import org.jetbrains.kotlin.psi.KtValueArgumentList
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.containsInside
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
|
||||||
|
|
||||||
class MoveLambdaOutsideParenthesesIntention : SelfTargetingIntention<KtCallExpression>(KtCallExpression::class.java, "Move lambda argument out of parentheses") {
|
|
||||||
companion object {
|
|
||||||
fun moveFunctionLiteralOutsideParenthesesIfPossible(expression: KtLambdaExpression) {
|
|
||||||
val call = ((expression.parent as? KtValueArgument)?.parent as? KtValueArgumentList)?.parent as? KtCallExpression ?: return
|
|
||||||
if (call.canMoveLambdaOutsideParentheses()) {
|
|
||||||
call.moveFunctionLiteralOutsideParentheses()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isApplicableTo(element: KtCallExpression, caretOffset: Int): Boolean {
|
|
||||||
if (!element.canMoveLambdaOutsideParentheses()) return false
|
|
||||||
|
|
||||||
val lambdaExpression = element.getLastLambdaExpression() ?: return false
|
|
||||||
val argument = lambdaExpression.getStrictParentOfType<KtValueArgument>() ?: return false
|
|
||||||
if (caretOffset < argument.startOffset) return false
|
|
||||||
val bodyRange = lambdaExpression.bodyExpression?.textRange ?: return true
|
|
||||||
return !bodyRange.containsInside(caretOffset)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun applyTo(element: KtCallExpression, editor: Editor?) {
|
|
||||||
element.moveFunctionLiteralOutsideParentheses()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic
|
|||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||||
|
import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParenthesesIfPossible
|
||||||
import org.jetbrains.kotlin.idea.core.replaced
|
import org.jetbrains.kotlin.idea.core.replaced
|
||||||
import org.jetbrains.kotlin.idea.core.setVisibility
|
import org.jetbrains.kotlin.idea.core.setVisibility
|
||||||
import org.jetbrains.kotlin.idea.inspections.*
|
import org.jetbrains.kotlin.idea.inspections.*
|
||||||
@@ -69,7 +70,7 @@ object J2KPostProcessingRegistrar {
|
|||||||
init {
|
init {
|
||||||
_processings.add(RemoveExplicitTypeArgumentsProcessing())
|
_processings.add(RemoveExplicitTypeArgumentsProcessing())
|
||||||
_processings.add(RemoveRedundantOverrideVisibilityProcessing())
|
_processings.add(RemoveRedundantOverrideVisibilityProcessing())
|
||||||
_processings.add(MoveLambdaOutsideParenthesesProcessing())
|
registerInspectionBasedProcessing(MoveLambdaOutsideParenthesesInspection())
|
||||||
_processings.add(FixObjectStringConcatenationProcessing())
|
_processings.add(FixObjectStringConcatenationProcessing())
|
||||||
_processings.add(ConvertToStringTemplateProcessing())
|
_processings.add(ConvertToStringTemplateProcessing())
|
||||||
_processings.add(UsePropertyAccessSyntaxProcessing())
|
_processings.add(UsePropertyAccessSyntaxProcessing())
|
||||||
@@ -243,19 +244,6 @@ object J2KPostProcessingRegistrar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MoveLambdaOutsideParenthesesProcessing : J2kPostProcessing {
|
|
||||||
override val writeActionNeeded = true
|
|
||||||
|
|
||||||
private val intention = MoveLambdaOutsideParenthesesIntention()
|
|
||||||
|
|
||||||
override fun createAction(element: KtElement, diagnostics: Diagnostics): (() -> Unit)? {
|
|
||||||
if (element !is KtCallExpression) return null
|
|
||||||
val literalArgument = element.valueArguments.lastOrNull()?.getArgumentExpression()?.unpackFunctionLiteral() ?: return null
|
|
||||||
if (!intention.isApplicableTo(element, literalArgument.textOffset)) return null
|
|
||||||
return { intention.applyTo(element, null) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ConvertToStringTemplateProcessing : J2kPostProcessing {
|
private class ConvertToStringTemplateProcessing : J2kPostProcessing {
|
||||||
override val writeActionNeeded = true
|
override val writeActionNeeded = true
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
org.jetbrains.kotlin.idea.inspections.MoveLambdaOutsideParenthesesInspection
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// IS_APPLICABLE: false
|
// PROBLEM: none
|
||||||
fun foo() {
|
fun foo() {
|
||||||
bar() <caret>{ it }
|
bar() <caret>{ it }
|
||||||
}
|
}
|
||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
// IS_APPLICABLE: false
|
// PROBLEM: none
|
||||||
|
|
||||||
fun <T> doSomething(a: T) {}
|
fun <T> doSomething(a: T) {}
|
||||||
|
|
||||||
fun foo(x: Int) {
|
fun foo(x: Int) {
|
||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
// IS_APPLICABLE: false
|
// PROBLEM: none
|
||||||
|
|
||||||
fun <T> doSomething(a: T) {}
|
fun <T> doSomething(a: T) {}
|
||||||
|
|
||||||
fun foo(x: Int) {
|
fun foo(x: Int) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// IS_APPLICABLE: false
|
// PROBLEM: none
|
||||||
fun foo() {
|
fun foo() {
|
||||||
bar(<caret>{ it }) {it}
|
bar(<caret>{ it }) {it}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// IS_APPLICABLE: false
|
// PROBLEM: none
|
||||||
fun foo() {
|
fun foo() {
|
||||||
bar(<caret>{ it })
|
bar(<caret>{ it })
|
||||||
}
|
}
|
||||||
+1
-1
@@ -3,7 +3,7 @@ fun foo() {
|
|||||||
bar(2, {
|
bar(2, {
|
||||||
val x = 3
|
val x = 3
|
||||||
it * x
|
it * x
|
||||||
})<caret>
|
<caret>})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bar(a: Int, b: (Int) -> Int) {
|
fun bar(a: Int, b: (Int) -> Int) {
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
// IS_APPLICABLE: true
|
// IS_APPLICABLE: true
|
||||||
fun foo() {
|
fun foo() {
|
||||||
bar(3, 2, 1, { it }<caret>)
|
bar(3, 2, 1, { it <caret>})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int {
|
fun bar(name1: Int, name2: Int, name3: Int, name4: (Int) -> Int) : Int {
|
||||||
@@ -1 +0,0 @@
|
|||||||
org.jetbrains.kotlin.idea.intentions.MoveLambdaOutsideParenthesesIntention
|
|
||||||
+117
@@ -2521,6 +2521,123 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class MoveLambdaOutsideParentheses extends AbstractLocalInspectionTest {
|
||||||
|
public void testAllFilesPresentInMoveLambdaOutsideParentheses() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ambigousOverload.kt")
|
||||||
|
public void testAmbigousOverload() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/ambigousOverload.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("functionalValueCall.kt")
|
||||||
|
public void testFunctionalValueCall() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/functionalValueCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inapplicable1.kt")
|
||||||
|
public void testInapplicable1() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/inapplicable1.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inapplicable2.kt")
|
||||||
|
public void testInapplicable2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/inapplicable2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inapplicable3.kt")
|
||||||
|
public void testInapplicable3() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/inapplicable3.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inapplicableAlreadyHasFunctionLiteral.kt")
|
||||||
|
public void testInapplicableAlreadyHasFunctionLiteral() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/inapplicableAlreadyHasFunctionLiteral.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inapplicableOptionalParametersAfter.kt")
|
||||||
|
public void testInapplicableOptionalParametersAfter() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/inapplicableOptionalParametersAfter.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("labeledLambda.kt")
|
||||||
|
public void testLabeledLambda() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/labeledLambda.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaWithCommas.kt")
|
||||||
|
public void testLambdaWithCommas() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/lambdaWithCommas.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaWithCommas2.kt")
|
||||||
|
public void testLambdaWithCommas2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/lambdaWithCommas2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("lambdaWithCommas3.kt")
|
||||||
|
public void testLambdaWithCommas3() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/lambdaWithCommas3.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda1.kt")
|
||||||
|
public void testMoveLambda1() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda1.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda2.kt")
|
||||||
|
public void testMoveLambda2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda3.kt")
|
||||||
|
public void testMoveLambda3() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda3.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda4.kt")
|
||||||
|
public void testMoveLambda4() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda4.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda5.kt")
|
||||||
|
public void testMoveLambda5() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda5.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("moveLambda6.kt")
|
||||||
|
public void testMoveLambda6() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/moveLambda6.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("noTwoConsequentLambdas.kt")
|
||||||
|
public void testNoTwoConsequentLambdas() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/moveLambdaOutsideParentheses/noTwoConsequentLambdas.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/inspectionsLocal/moveSuspiciousCallableReferenceIntoParentheses")
|
@TestMetadata("idea/testData/inspectionsLocal/moveSuspiciousCallableReferenceIntoParentheses")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
-117
@@ -11941,123 +11941,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/intentions/moveLambdaOutsideParentheses")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public static class MoveLambdaOutsideParentheses extends AbstractIntentionTest {
|
|
||||||
public void testAllFilesPresentInMoveLambdaOutsideParentheses() throws Exception {
|
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/moveLambdaOutsideParentheses"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("ambigousOverload.kt")
|
|
||||||
public void testAmbigousOverload() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/ambigousOverload.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("functionalValueCall.kt")
|
|
||||||
public void testFunctionalValueCall() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/functionalValueCall.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inapplicable1.kt")
|
|
||||||
public void testInapplicable1() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inapplicable2.kt")
|
|
||||||
public void testInapplicable2() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inapplicable3.kt")
|
|
||||||
public void testInapplicable3() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inapplicableAlreadyHasFunctionLiteral.kt")
|
|
||||||
public void testInapplicableAlreadyHasFunctionLiteral() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicableAlreadyHasFunctionLiteral.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("inapplicableOptionalParametersAfter.kt")
|
|
||||||
public void testInapplicableOptionalParametersAfter() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicableOptionalParametersAfter.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("labeledLambda.kt")
|
|
||||||
public void testLabeledLambda() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/labeledLambda.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("lambdaWithCommas.kt")
|
|
||||||
public void testLambdaWithCommas() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/lambdaWithCommas.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("lambdaWithCommas2.kt")
|
|
||||||
public void testLambdaWithCommas2() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/lambdaWithCommas2.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("lambdaWithCommas3.kt")
|
|
||||||
public void testLambdaWithCommas3() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/lambdaWithCommas3.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda1.kt")
|
|
||||||
public void testMoveLambda1() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda2.kt")
|
|
||||||
public void testMoveLambda2() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda3.kt")
|
|
||||||
public void testMoveLambda3() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda4.kt")
|
|
||||||
public void testMoveLambda4() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda5.kt")
|
|
||||||
public void testMoveLambda5() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda5.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("moveLambda6.kt")
|
|
||||||
public void testMoveLambda6() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda6.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("noTwoConsequentLambdas.kt")
|
|
||||||
public void testNoTwoConsequentLambdas() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/moveLambdaOutsideParentheses/noTwoConsequentLambdas.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("idea/testData/intentions/moveMemberToTopLevel")
|
@TestMetadata("idea/testData/intentions/moveMemberToTopLevel")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user