diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 0920196f4a4..c947ed0b775 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -364,9 +364,6 @@ public interface Errors { DiagnosticFactory0 USELESS_VARARG_ON_PARAMETER = DiagnosticFactory0.create(WARNING); - DiagnosticFactory0 DEPRECATED_LAMBDA_SYNTAX = - DiagnosticFactory0.create(WARNING, FUNCTION_LITERAL_EXPRESSION_DECLARATION); - // Named parameters DiagnosticFactory0 DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE = DiagnosticFactory0.create(ERROR, PARAMETER_DEFAULT_VALUE); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index d7488485519..5a08815254b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -178,12 +178,6 @@ public object PositioningStrategies { } } - public val FUNCTION_LITERAL_EXPRESSION_DECLARATION: PositioningStrategy - = object : PositioningStrategy() { - override fun mark(element: JetFunctionLiteralExpression) = DECLARATION_SIGNATURE_OR_DEFAULT.mark(element.getFunctionLiteral()) - override fun isValid(element: JetFunctionLiteralExpression) = DECLARATION_SIGNATURE_OR_DEFAULT.isValid(element.getFunctionLiteral()) - } - public val TYPE_PARAMETERS_OR_DECLARATION_SIGNATURE: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: JetDeclaration): List { if (element is JetTypeParameterListOwner) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 622bbf69640..282096b79f0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -226,8 +226,6 @@ public class DefaultErrorMessages { MAP.put(FUNCTION_EXPRESSION_PARAMETER_WITH_DEFAULT_VALUE, "A function expression is not allowed to specify default values for its parameters"); MAP.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless"); - MAP.put(DEPRECATED_LAMBDA_SYNTAX, - "This syntax for lambda is deprecated. Use short lambda notation {a[: Int], b[: String] -> ...} or function expression instead."); MAP.put(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, "Projections are not allowed on type arguments of functions and properties"); MAP.put(SUPERTYPE_NOT_INITIALIZED, "This type has a constructor, and thus must be initialized here"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetParameterList.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetParameterList.java index 4fbcec169c2..b0383f08244 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetParameterList.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetParameterList.java @@ -63,14 +63,4 @@ public class JetParameterList extends JetElementImplStub(element), CleanupFix { - override fun getText() = JetBundle.message("migrate.lambda.syntax") - override fun getFamilyName() = JetBundle.message("migrate.lambda.syntax.family") - - override fun invoke(project: Project, editor: Editor?, file: JetFile) { - DeprecatedSyntaxFix.createFix(element).runFix() - } - - companion object Factory : JetSingleIntentionActionFactory() { - override fun createAction(diagnostic: Diagnostic) - = (diagnostic.getPsiElement() as? JetFunctionLiteralExpression)?.let { DeprecatedLambdaSyntaxFix(it) } - - public fun createWholeProjectFixFactory(): JetSingleIntentionActionFactory = createIntentionFactory { - JetWholeProjectForEachElementOfTypeFix.createByTaskFactory( - taskFactory = fun (it: JetFunctionLiteralExpression) = fixTaskFactory(it), - taskProcessor = { it.runFix() }, - name = "Migrate lambda syntax in whole project" - ) - } - - private fun fixTaskFactory(functionLiteralExpression: JetFunctionLiteralExpression): DeprecatedSyntaxFix? { - return if (JetPsiUtil.isDeprecatedLambdaSyntax(functionLiteralExpression)) { - DeprecatedSyntaxFix.createFix(functionLiteralExpression) - } - else { - null - } - } - } -} - -private interface DeprecatedSyntaxFix { - // you must run it under write action - fun runFix() - - internal companion object { - fun createFix(functionLiteralExpression: JetFunctionLiteralExpression): DeprecatedSyntaxFix { - val functionLiteral = functionLiteralExpression.getFunctionLiteral() - val hasNoReturnAndReceiverType = !functionLiteral.hasDeclaredReturnType() && functionLiteral.getReceiverTypeReference() == null - - return if (hasNoReturnAndReceiverType) DeparenthesizeParameterList(functionLiteralExpression) - else LambdaToFunctionExpression(functionLiteralExpression) - } - } -} - -private class DeparenthesizeParameterList( - val functionLiteralExpression: JetFunctionLiteralExpression -): DeprecatedSyntaxFix { - - override fun runFix() { - if (!JetPsiUtil.isDeprecatedLambdaSyntax(functionLiteralExpression)) return - - val psiFactory = JetPsiFactory(functionLiteralExpression) - val functionLiteral = functionLiteralExpression.getFunctionLiteral() - val parameterList = functionLiteral.getValueParameterList() - if (parameterList != null && parameterList.isParenthesized()) { - val oldParameterList = parameterList.getText() - val newParameterList = oldParameterList.substring(1..oldParameterList.length() - 2) - parameterList.replace(psiFactory.createFunctionLiteralParameterList(newParameterList)) - } - } -} - -private class LambdaToFunctionExpression( - val functionLiteralExpression: JetFunctionLiteralExpression -): DeprecatedSyntaxFix { - val functionLiteralArgumentName: Name? - val receiverType: String? - val returnType: String? - - init { - val bindingContext = functionLiteralExpression.analyze() - val functionLiteralType = bindingContext.getType(functionLiteralExpression) - assert(functionLiteralType != null && KotlinBuiltIns.isExactFunctionOrExtensionFunctionType(functionLiteralType)) { - "Broken function type for expression: ${functionLiteralExpression.getText()}, at: ${DiagnosticUtils.atLocation(functionLiteralExpression)}" - } - functionLiteralType!! - receiverType = KotlinBuiltIns.getReceiverType(functionLiteralType)?.let { IdeDescriptorRenderers.SOURCE_CODE.renderType(it) } - returnType = KotlinBuiltIns.getReturnTypeFromFunctionType(functionLiteralType).let { - if (KotlinBuiltIns.isUnit(it)) - null - else - IdeDescriptorRenderers.SOURCE_CODE.renderType(it) - } - functionLiteralArgumentName = getFunctionLiteralArgument()?.getFunctionLiteralArgumentName(bindingContext) - } - - override fun runFix() { - if (!JetPsiUtil.isDeprecatedLambdaSyntax(functionLiteralExpression)) return - - val newFunctionExpression = createFunctionExpression() - - val literalArgument = getFunctionLiteralArgument() - val replacedFunctionExpression = if (literalArgument == null) { - functionLiteralExpression.replace(newFunctionExpression) - } - else { - literalArgument.moveInsideParenthesesAndReplaceWith(newFunctionExpression, functionLiteralArgumentName). - getValueArguments().last().getArgumentExpression() - } - - val functionExpression = JetPsiUtil.deparenthesize(replacedFunctionExpression as JetExpression) as JetNamedFunction - - ShortenReferences.DEFAULT.process( - listOf(functionExpression.getReceiverTypeReference(), functionExpression.getTypeReference()).filterNotNull()) - } - - private fun getFunctionLiteralArgument(): JetFunctionLiteralArgument? { - val argument = functionLiteralExpression.getParentOfType(strict = false) - - if (argument != null && argument.getFunctionLiteral() == functionLiteralExpression) { - return argument - } - return null - } - - private fun JetExpression.replaceWithReturn(psiFactory: JetPsiFactory) { - if (this is JetReturnExpression) { - return - } - else { - replace(psiFactory.createExpressionByPattern("return $0", this)) - } - } - - private fun getLambdaLabelName(): String? { - val labeledExpression = functionLiteralExpression.getParentOfType(strict = false) - if (labeledExpression != null && JetPsiUtil.deparenthesize(labeledExpression.getBaseExpression()) == functionLiteralExpression) { - return labeledExpression.getLabelName() - } - return null - } - - private fun createFunctionExpression(): JetNamedFunction { - val psiFactory = JetPsiFactory(functionLiteralExpression) - val functionLiteral = functionLiteralExpression.getFunctionLiteral() - val functionName = getLambdaLabelName() - val parameterList = functionLiteral.getValueParameterList()?.getText() - - val functionDeclaration = "fun " + - (receiverType?.let { "$it." } ?: "") + - (functionName ?: "") + - (parameterList ?: "()") + - (returnType?.let { ": $it" } ?: "") - - val functionWithEmptyBody = psiFactory.createFunction(functionDeclaration + " {}") - - val blockExpression = functionLiteral.getBodyExpression() ?: return functionWithEmptyBody - - val statements = blockExpression.getStatements() - if (statements.isEmpty()) return functionWithEmptyBody - - if (statements.size() == 1) { - return psiFactory.createFunction(functionDeclaration + " = " + statements.first().getText()) - } - - // many statements - if (returnType != null) statements.filterIsInstance().lastOrNull()?.replaceWithReturn(psiFactory) - - val fromElement = functionLiteral.getArrow() ?: functionLiteral.getLBrace() - val toElement = functionLiteral.getRBrace() - // to include comments in the start/end of the body - val bodyText = fromElement.siblings(withItself = false) - .takeWhile { it != toElement } - .map { it.getText() } - .joinToString("") - return psiFactory.createFunction(functionDeclaration + "{ " + bodyText + "}") - } - -} diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index ad317655f37..4e91a5ff57c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -222,7 +222,6 @@ public class QuickFixRegistrar : QuickFixContributor { NO_VALUE_FOR_PARAMETER.registerFactory(ChangeFunctionSignatureFix.createFactory()) UNUSED_PARAMETER.registerFactory(ChangeFunctionSignatureFix.createFactoryForUnusedParameter()) EXPECTED_PARAMETERS_NUMBER_MISMATCH.registerFactory(ChangeFunctionSignatureFix.createFactoryForParametersNumberMismatch()) - DEPRECATED_LAMBDA_SYNTAX.registerFactory(DeprecatedLambdaSyntaxFix, DeprecatedLambdaSyntaxFix.createWholeProjectFixFactory()) EXPECTED_PARAMETER_TYPE_MISMATCH.registerFactory(ChangeTypeFix.createFactoryForExpectedParameterTypeMismatch()) EXPECTED_RETURN_TYPE_MISMATCH.registerFactory(ChangeTypeFix.createFactoryForExpectedReturnTypeMismatch()) diff --git a/idea/testData/inspections/cleanup/cleanup.kt b/idea/testData/inspections/cleanup/cleanup.kt index abd6d73001d..77da842b84b 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt +++ b/idea/testData/inspections/cleanup/cleanup.kt @@ -2,8 +2,6 @@ import pack.oldFun1 import pack.oldFun2 // should not be removed for non-deprecated overload used import pack.oldFun3 -val f = { (a: Int, b: Int) -> a + b } - class A private() val x = fun foo(x: String) { } diff --git a/idea/testData/inspections/cleanup/cleanup.kt.after b/idea/testData/inspections/cleanup/cleanup.kt.after index b2b4fae6b09..0e5a85b5847 100644 --- a/idea/testData/inspections/cleanup/cleanup.kt.after +++ b/idea/testData/inspections/cleanup/cleanup.kt.after @@ -1,8 +1,6 @@ import pack.bar import pack.oldFun2 // should not be removed for non-deprecated overload used -val f = { a: Int, b: Int -> a + b } - class A private constructor() val x = fun(x: String) { } diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt deleted file mode 100644 index 0ef9a420ef4..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo a@ { Int.(a: String): A -> - A() - A() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt.after deleted file mode 100644 index 2d52c8962f7..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo(fun Int.a(a: String): A { - A() - return A() -}) \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt deleted file mode 100644 index a7a5b500365..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo a@ { (a: String): A -> - A() - A() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt.after deleted file mode 100644 index 2d52c8962f7..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo(fun Int.a(a: String): A { - A() - return A() -}) \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt deleted file mode 100644 index 7283720e3f8..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo a@ { Int.(a: String) -> - A() - A() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt.after deleted file mode 100644 index 2d52c8962f7..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Int.(String) -> A) {} - -val a = foo(fun Int.a(a: String): A { - A() - return A() -}) \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt deleted file mode 100644 index e2cf5feaf8a..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt +++ /dev/null @@ -1,9 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Any) {} - -val a = foo a@ { Int.(a: String): A -> - A() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt.after deleted file mode 100644 index 008ae180c06..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Any) {} - -val a = foo(fun Int.a(a: String): A = A()) \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt deleted file mode 100644 index 70ae3ee734d..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt +++ /dev/null @@ -1,12 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: (Int).(String) -> Int) { - -} - - -val a = foo ({ - (Int).(a: String) -> 4 -}) diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt.after deleted file mode 100644 index f4758d2b2a3..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: (Int).(String) -> Int) { - -} - - -val a = foo (fun Int.(a: String): Int = 4) diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt deleted file mode 100644 index 141572380f0..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Any) {} - -val a = foo a@ { - - val a = { (): Int -> 1 } -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt.after deleted file mode 100644 index 202ba59ebe8..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// "Migrate lambda syntax" "true" - -class A - -fun foo(a: Any) {} - -val a = foo a@ { - - val a = fun(): Int = 1 -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.Dependency.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.Dependency.kt deleted file mode 100644 index a2af686e6d2..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.Dependency.kt +++ /dev/null @@ -1,6 +0,0 @@ -val h = { -> } - -val l = bar@ fun Int.bar() { -} - -val s = (fun(): Int = 5)() \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.kt deleted file mode 100644 index f058cdb2185..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.after.kt +++ /dev/null @@ -1,8 +0,0 @@ -// "Migrate lambda syntax in whole project" "true" - -val a = fun(): Int { - - val b = fun(): Int = 5 - - return b() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Dependency.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Dependency.kt deleted file mode 100644 index 3baf83dcda7..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Dependency.kt +++ /dev/null @@ -1,5 +0,0 @@ -val h = { () -> } - -val l = bar@ { Int.() -> } - -val s = {(): Int -> 5}() \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Main.kt b/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Main.kt deleted file mode 100644 index 7437b1591f8..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Main.kt +++ /dev/null @@ -1,8 +0,0 @@ -// "Migrate lambda syntax in whole project" "true" - -val a = { (): Int -> - - val b = { (): Int -> 5 } - - b() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt b/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt deleted file mode 100644 index 32e9ae225c2..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt +++ /dev/null @@ -1,8 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = { (p: Int): String -> - val v = p + 1 - v.toString() - // returns v.toString() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt.after deleted file mode 100644 index 524ae270efd..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt.after +++ /dev/null @@ -1,8 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = fun(p: Int): String { - val v = p + 1 - return v.toString() - // returns v.toString() -} \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt b/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt deleted file mode 100644 index f1f900f136c..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt +++ /dev/null @@ -1,4 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = { (a: Int) -> } \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt.after deleted file mode 100644 index 5ff47f7e626..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = { a: Int -> } \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt b/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt deleted file mode 100644 index e03f20b2be8..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt +++ /dev/null @@ -1,4 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = { Int.(a: Int): String -> "" } \ No newline at end of file diff --git a/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt.after b/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt.after deleted file mode 100644 index 8cbc193d02c..00000000000 --- a/idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt.after +++ /dev/null @@ -1,4 +0,0 @@ -// "Migrate lambda syntax" "true" - - -val a = fun Int.(a: Int): String = "" \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java index 001805d65f8..db14b12c0e9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixMultiFileTestGenerated.java @@ -1078,21 +1078,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes } } - @TestMetadata("idea/testData/quickfix/migration/lambdaSyntax") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class LambdaSyntax extends AbstractQuickFixMultiFileTest { - public void testAllFilesPresentInLambdaSyntax() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration/lambdaSyntax"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); - } - - @TestMetadata("lambdaSyntaxMultiple.before.Main.kt") - public void testLambdaSyntaxMultiple() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/lambdaSyntaxMultiple.before.Main.kt"); - doTestWithExtraFile(fileName); - } - } - @TestMetadata("idea/testData/quickfix/migration/migrateJavaAnnotationMethodCall") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 8eef5687397..d4448a3bab7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -4124,69 +4124,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } - @TestMetadata("idea/testData/quickfix/migration/lambdaSyntax") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class LambdaSyntax extends AbstractQuickFixTest { - public void testAllFilesPresentInLambdaSyntax() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/migration/lambdaSyntax"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); - } - - @TestMetadata("labelInLiteralArgument.kt") - public void testLabelInLiteralArgument() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgument.kt"); - doTest(fileName); - } - - @TestMetadata("labelInLiteralArgumentImplicitReceiverType.kt") - public void testLabelInLiteralArgumentImplicitReceiverType() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReceiverType.kt"); - doTest(fileName); - } - - @TestMetadata("labelInLiteralArgumentImplicitReturnType.kt") - public void testLabelInLiteralArgumentImplicitReturnType() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentImplicitReturnType.kt"); - doTest(fileName); - } - - @TestMetadata("labelInLiteralArgumentOneStatement.kt") - public void testLabelInLiteralArgumentOneStatement() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/labelInLiteralArgumentOneStatement.kt"); - doTest(fileName); - } - - @TestMetadata("lambdaInFunctionArgument.kt") - public void testLambdaInFunctionArgument() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/lambdaInFunctionArgument.kt"); - doTest(fileName); - } - - @TestMetadata("lambdaInsideLambda.kt") - public void testLambdaInsideLambda() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/lambdaInsideLambda.kt"); - doTest(fileName); - } - - @TestMetadata("lastStatementIsComment.kt") - public void testLastStatementIsComment() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/lastStatementIsComment.kt"); - doTest(fileName); - } - - @TestMetadata("paranthesizedParameters.kt") - public void testParanthesizedParameters() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/paranthesizedParameters.kt"); - doTest(fileName); - } - - @TestMetadata("receiverAndReturnInExpression.kt") - public void testReceiverAndReturnInExpression() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/lambdaSyntax/receiverAndReturnInExpression.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/quickfix/migration/missingConstructorKeyword") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)