From 64321dce56469e6ba0b7d55601270c2bdb5cf167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sapalski?= Date: Mon, 18 Feb 2013 17:27:56 +0100 Subject: [PATCH] Quickfix for CANNOT_CHECK_FOR_ERASED. --- .../quickfix/ChangeToStarProjectionFix.java | 12 ++++++--- .../jet/plugin/quickfix/QuickFixes.java | 5 +++- ...hangeToStarProjectionMultipleParameters.kt | 2 ++ .../afterChangeToStarProjectionNullable.kt | 2 ++ ...erChangeToStarProjectionSingleParameter.kt | 2 ++ ...hangeToStarProjectionMultipleParameters.kt | 2 ++ .../beforeChangeToStarProjectionNullable.kt | 2 ++ ...reChangeToStarProjectionSingleParameter.kt | 2 ++ .../quickfix/QuickFixTestGenerated.java | 26 ++++++++++++++++++- 9 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionMultipleParameters.kt create mode 100644 idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionNullable.kt create mode 100644 idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionSingleParameter.kt create mode 100644 idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionMultipleParameters.kt create mode 100644 idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionNullable.kt create mode 100644 idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionSingleParameter.kt diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeToStarProjectionFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeToStarProjectionFix.java index 0a94d425789..18c050c42d3 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeToStarProjectionFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeToStarProjectionFix.java @@ -59,11 +59,17 @@ public class ChangeToStarProjectionFix extends JetIntentionAction" "true" +fun isStringToIntMap(map : Any) = map is Map<*, *> \ No newline at end of file diff --git a/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionNullable.kt b/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionNullable.kt new file mode 100644 index 00000000000..2fde707f30a --- /dev/null +++ b/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionNullable.kt @@ -0,0 +1,2 @@ +// "Change type argument list to <*>" "true" +fun isStringList(list : Any) = list is List<*>? \ No newline at end of file diff --git a/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionSingleParameter.kt b/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionSingleParameter.kt new file mode 100644 index 00000000000..dd9e7303574 --- /dev/null +++ b/idea/testData/quickfix/addStarProjections/checkType/afterChangeToStarProjectionSingleParameter.kt @@ -0,0 +1,2 @@ +// "Change type argument list to <*>" "true" +fun isStringList(list : Any?) = list is (List<*>) \ No newline at end of file diff --git a/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionMultipleParameters.kt b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionMultipleParameters.kt new file mode 100644 index 00000000000..fbe68541fe6 --- /dev/null +++ b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionMultipleParameters.kt @@ -0,0 +1,2 @@ +// "Change type argument list to <*, *>" "true" +fun isStringToIntMap(map : Any) = map is Map<String, Int> \ No newline at end of file diff --git a/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionNullable.kt b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionNullable.kt new file mode 100644 index 00000000000..5854e690c44 --- /dev/null +++ b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionNullable.kt @@ -0,0 +1,2 @@ +// "Change type argument list to <*>" "true" +fun isStringList(list : Any) = list is List<String>? \ No newline at end of file diff --git a/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionSingleParameter.kt b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionSingleParameter.kt new file mode 100644 index 00000000000..2f807b2736b --- /dev/null +++ b/idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionSingleParameter.kt @@ -0,0 +1,2 @@ +// "Change type argument list to <*>" "true" +fun isStringList(list : Any?) = list is (List<String>) \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java index 77ce71d4627..92e6c9c070d 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java @@ -146,7 +146,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } @TestMetadata("idea/testData/quickfix/addStarProjections") - @InnerTestClasses({AddStarProjections.Cast.class, AddStarProjections.JavaClass.class, AddStarProjections.When.class}) + @InnerTestClasses({AddStarProjections.Cast.class, AddStarProjections.CheckType.class, AddStarProjections.JavaClass.class, AddStarProjections.When.class}) public static class AddStarProjections extends AbstractQuickFixTest { public void testAllFilesPresentInAddStarProjections() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/addStarProjections"), Pattern.compile("^before(\\w+)\\.kt$"), true); @@ -200,6 +200,29 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } + @TestMetadata("idea/testData/quickfix/addStarProjections/checkType") + public static class CheckType extends AbstractQuickFixTest { + public void testAllFilesPresentInCheckType() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/addStarProjections/checkType"), Pattern.compile("^before(\\w+)\\.kt$"), true); + } + + @TestMetadata("beforeChangeToStarProjectionMultipleParameters.kt") + public void testChangeToStarProjectionMultipleParameters() throws Exception { + doTest("idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionMultipleParameters.kt"); + } + + @TestMetadata("beforeChangeToStarProjectionNullable.kt") + public void testChangeToStarProjectionNullable() throws Exception { + doTest("idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionNullable.kt"); + } + + @TestMetadata("beforeChangeToStarProjectionSingleParameter.kt") + public void testChangeToStarProjectionSingleParameter() throws Exception { + doTest("idea/testData/quickfix/addStarProjections/checkType/beforeChangeToStarProjectionSingleParameter.kt"); + } + + } + @TestMetadata("idea/testData/quickfix/addStarProjections/javaClass") public static class JavaClass extends AbstractQuickFixTest { public void testAllFilesPresentInJavaClass() throws Exception { @@ -270,6 +293,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { TestSuite suite = new TestSuite("AddStarProjections"); suite.addTestSuite(AddStarProjections.class); suite.addTestSuite(Cast.class); + suite.addTestSuite(CheckType.class); suite.addTestSuite(JavaClass.class); suite.addTestSuite(When.class); return suite;