From 31d2aa23f557f1855b8ea2794af48263b151853c Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Wed, 23 Sep 2015 21:11:50 +0300 Subject: [PATCH] Remove `ChangeType` quickfix for lamdas with deprecated syntax --- .../kotlin/idea/quickfix/ChangeTypeFix.java | 12 ---------- .../kotlin/idea/quickfix/QuickFixRegistrar.kt | 1 - .../expectedReturnTypeMismatch.kt | 9 ------- .../expectedReturnTypeMismatch.kt.after | 9 ------- ...ypeWithoutChangingFunctionParameterType.kt | 7 ------ ...houtChangingFunctionParameterType.kt.after | 7 ------ ...nLiteralTypeWithoutChangingPropertyType.kt | 7 ------ ...alTypeWithoutChangingPropertyType.kt.after | 7 ------ .../expectedTypeMismatch.kt | 7 ------ .../expectedTypeMismatch.kt.after | 7 ------ .../idea/quickfix/QuickFixTestGenerated.java | 24 ------------------- 11 files changed, 97 deletions(-) delete mode 100644 idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt delete mode 100644 idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt.after delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt.after delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt.after delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt delete mode 100644 idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt.after diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeTypeFix.java b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeTypeFix.java index cb2fbe0af70..9454c242106 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeTypeFix.java +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeTypeFix.java @@ -78,16 +78,4 @@ public class ChangeTypeFix extends JetIntentionAction { } }; } - - @NotNull - public static JetSingleIntentionActionFactory createFactoryForExpectedReturnTypeMismatch() { - return new JetSingleIntentionActionFactory() { - @Nullable - @Override - public IntentionAction createAction(@NotNull Diagnostic diagnostic) { - DiagnosticWithParameters1 diagnosticWithParameters = Errors.EXPECTED_RETURN_TYPE_MISMATCH.cast(diagnostic); - return new ChangeTypeFix(diagnosticWithParameters.getPsiElement(), diagnosticWithParameters.getA()); - } - }; - } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 4e91a5ff57c..86b25b1c9e5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -224,7 +224,6 @@ public class QuickFixRegistrar : QuickFixContributor { EXPECTED_PARAMETERS_NUMBER_MISMATCH.registerFactory(ChangeFunctionSignatureFix.createFactoryForParametersNumberMismatch()) EXPECTED_PARAMETER_TYPE_MISMATCH.registerFactory(ChangeTypeFix.createFactoryForExpectedParameterTypeMismatch()) - EXPECTED_RETURN_TYPE_MISMATCH.registerFactory(ChangeTypeFix.createFactoryForExpectedReturnTypeMismatch()) val changeFunctionLiteralReturnTypeFix = ChangeFunctionLiteralReturnTypeFix.createFactoryForExpectedOrAssignmentTypeMismatch() EXPECTED_TYPE_MISMATCH.registerFactory(changeFunctionLiteralReturnTypeFix) diff --git a/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt deleted file mode 100644 index 2194b0bc545..00000000000 --- a/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt +++ /dev/null @@ -1,9 +0,0 @@ -// "Change type from 'A' to 'B'" "true" -interface A {} -interface B : A {} - -fun foo(f: (B) -> B) { - foo { - (b: B): A -> b - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt.after deleted file mode 100644 index a29b24e25ca..00000000000 --- a/idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt.after +++ /dev/null @@ -1,9 +0,0 @@ -// "Change type from 'A' to 'B'" "true" -interface A {} -interface B : A {} - -fun foo(f: (B) -> B) { - foo { - (b: B): B -> b - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt deleted file mode 100644 index 0a04b9f473b..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Change function literal return type to 'String'" "true" -fun foo(f: (String) -> Any) { - foo { - (s: String): Int -> - s - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt.after deleted file mode 100644 index b2b6552068c..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Change function literal return type to 'String'" "true" -fun foo(f: (String) -> Any) { - foo { - (s: String): String -> - s - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt deleted file mode 100644 index dbec7994ac1..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Change function literal return type to 'String'" "true" -fun foo() { - val f: (String) -> String = { - (s: Any): Int -> - "" - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt.after deleted file mode 100644 index 35be90c1bea..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Change function literal return type to 'String'" "true" -fun foo() { - val f: (String) -> String = { - (s: Any): String -> - "" - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt deleted file mode 100644 index 379a397ab85..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 'bar' type to '(() -> Long) -> Unit'" "true" -fun foo() { - val bar: () -> Double = { - (f: () -> Long): String -> - var x = 5 - } -} diff --git a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt.after b/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt.after deleted file mode 100644 index d51e2648772..00000000000 --- a/idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt.after +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 'bar' type to '(() -> Long) -> Unit'" "true" -fun foo() { - val bar: (() -> Long) -> Unit = { - (f: () -> Long): Unit -> - var x = 5 - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index d4448a3bab7..42c04278a70 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -5973,12 +5973,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } - @TestMetadata("expectedReturnTypeMismatch.kt") - public void testExpectedReturnTypeMismatch() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/expectedReturnTypeMismatch.kt"); - doTest(fileName); - } - @TestMetadata("hasNextFunctionReturnTypeMismatch.kt") public void testHasNextFunctionReturnTypeMismatch() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/hasNextFunctionReturnTypeMismatch.kt"); @@ -6251,18 +6245,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } - @TestMetadata("changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt") - public void testChangeFunctionLiteralTypeWithoutChangingFunctionParameterType() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingFunctionParameterType.kt"); - doTest(fileName); - } - - @TestMetadata("changeFunctionLiteralTypeWithoutChangingPropertyType.kt") - public void testChangeFunctionLiteralTypeWithoutChangingPropertyType() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionLiteralTypeWithoutChangingPropertyType.kt"); - doTest(fileName); - } - @TestMetadata("changeFunctionReturnTypeToFunctionType.kt") public void testChangeFunctionReturnTypeToFunctionType() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/changeFunctionReturnTypeToFunctionType.kt"); @@ -6281,12 +6263,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } - @TestMetadata("expectedTypeMismatch.kt") - public void testExpectedTypeMismatch() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/expectedTypeMismatch.kt"); - doTest(fileName); - } - @TestMetadata("multiFakeOverride.kt") public void testMultiFakeOverride() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/multiFakeOverride.kt");