diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 8305e2ada3c..a57d25e5e0b 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -1138,9 +1138,11 @@ fun main(args: Array) { testClass { val pattern = "^([\\w\\-_]+)\\.kt$" model("quickfix/abstract", pattern = pattern, filenameStartsLowerCase = true) + model("quickfix/expressions", pattern = pattern, filenameStartsLowerCase = true) model("quickfix/lateinit", pattern = pattern, filenameStartsLowerCase = true) model("quickfix/modifiers", pattern = pattern, filenameStartsLowerCase = true, recursive = false) model("quickfix/override/typeMismatchOnOverride", pattern = pattern, filenameStartsLowerCase = true, recursive = false) + model("quickfix/replaceWithSafeCall", pattern = pattern, filenameStartsLowerCase = true) model("quickfix/variables/changeMutability", pattern = pattern, filenameStartsLowerCase = true) } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixTestGenerated.java index 65ec0ce6097..c8aacb10955 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/quickfix/HighLevelQuickFixTestGenerated.java @@ -197,6 +197,189 @@ public class HighLevelQuickFixTestGenerated extends AbstractHighLevelQuickFixTes } } + @TestMetadata("idea/testData/quickfix/expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Expressions extends AbstractHighLevelQuickFixTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInExpressions() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/expressions"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true); + } + + @TestMetadata("fixNullableBinaryWithExclExcl.kt") + public void testFixNullableBinaryWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableBinaryWithExclExcl.kt"); + } + + @TestMetadata("fixNullableInfixWithExclExcl.kt") + public void testFixNullableInfixWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableInfixWithExclExcl.kt"); + } + + @TestMetadata("fixNullableIterableGenericWithExclExcl.kt") + public void testFixNullableIterableGenericWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableIterableGenericWithExclExcl.kt"); + } + + @TestMetadata("fixNullableIterableWithExclExcl.kt") + public void testFixNullableIterableWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableIterableWithExclExcl.kt"); + } + + @TestMetadata("fixNullableUnaryWithExclExcl.kt") + public void testFixNullableUnaryWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableUnaryWithExclExcl.kt"); + } + + @TestMetadata("fixNullableWithExclExclAbsentWithBadIterator.kt") + public void testFixNullableWithExclExclAbsentWithBadIterator() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt"); + } + + @TestMetadata("fixNullableWithIteratorWithExclExcl.kt") + public void testFixNullableWithIteratorWithExclExcl() throws Exception { + runTest("idea/testData/quickfix/expressions/fixNullableWithIteratorWithExclExcl.kt"); + } + + @TestMetadata("kt11594.kt") + public void testKt11594() throws Exception { + runTest("idea/testData/quickfix/expressions/kt11594.kt"); + } + + @TestMetadata("removeUselessCast.kt") + public void testRemoveUselessCast() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCast.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens1.kt") + public void testRemoveUselessCastForLambdaInParens1() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens1.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens2.kt") + public void testRemoveUselessCastForLambdaInParens2() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens2.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens3.kt") + public void testRemoveUselessCastForLambdaInParens3() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens3.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens4.kt") + public void testRemoveUselessCastForLambdaInParens4() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens4.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens5.kt") + public void testRemoveUselessCastForLambdaInParens5() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens5.kt"); + } + + @TestMetadata("removeUselessCastForLambdaInParens6.kt") + public void testRemoveUselessCastForLambdaInParens6() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastForLambdaInParens6.kt"); + } + + @TestMetadata("removeUselessCastInParens.kt") + public void testRemoveUselessCastInParens() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastInParens.kt"); + } + + @TestMetadata("removeUselessCastUnderSmartCast.kt") + public void testRemoveUselessCastUnderSmartCast() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessCastUnderSmartCast.kt"); + } + + @TestMetadata("removeUselessIsCheck.kt") + public void testRemoveUselessIsCheck() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheck.kt"); + } + + @TestMetadata("removeUselessIsCheckInWhen.kt") + public void testRemoveUselessIsCheckInWhen() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhen.kt"); + } + + @TestMetadata("removeUselessIsCheckInWhenExpressionless.kt") + public void testRemoveUselessIsCheckInWhenExpressionless() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenExpressionless.kt"); + } + + @TestMetadata("removeUselessIsCheckInWhenExpressionlessNegate.kt") + public void testRemoveUselessIsCheckInWhenExpressionlessNegate() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenExpressionlessNegate.kt"); + } + + @TestMetadata("removeUselessIsCheckInWhenNegate.kt") + public void testRemoveUselessIsCheckInWhenNegate() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheckInWhenNegate.kt"); + } + + @TestMetadata("removeUselessIsCheckNegate.kt") + public void testRemoveUselessIsCheckNegate() throws Exception { + runTest("idea/testData/quickfix/expressions/removeUselessIsCheckNegate.kt"); + } + + @TestMetadata("unnecessaryNonNullAssertion1.kt") + public void testUnnecessaryNonNullAssertion1() throws Exception { + runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion1.kt"); + } + + @TestMetadata("unnecessaryNonNullAssertion2.kt") + public void testUnnecessaryNonNullAssertion2() throws Exception { + runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion2.kt"); + } + + @TestMetadata("unnecessaryNonNullAssertion3.kt") + public void testUnnecessaryNonNullAssertion3() throws Exception { + runTest("idea/testData/quickfix/expressions/unnecessaryNonNullAssertion3.kt"); + } + + @TestMetadata("unnecessarySafeCall1.kt") + public void testUnnecessarySafeCall1() throws Exception { + runTest("idea/testData/quickfix/expressions/unnecessarySafeCall1.kt"); + } + + @TestMetadata("unsafeCall1.kt") + public void testUnsafeCall1() throws Exception { + runTest("idea/testData/quickfix/expressions/unsafeCall1.kt"); + } + + @TestMetadata("unsafeCall2.kt") + public void testUnsafeCall2() throws Exception { + runTest("idea/testData/quickfix/expressions/unsafeCall2.kt"); + } + + @TestMetadata("unsafeCall3.kt") + public void testUnsafeCall3() throws Exception { + runTest("idea/testData/quickfix/expressions/unsafeCall3.kt"); + } + + @TestMetadata("unsafeCall4.kt") + public void testUnsafeCall4() throws Exception { + runTest("idea/testData/quickfix/expressions/unsafeCall4.kt"); + } + + @TestMetadata("unsafeCall5.kt") + public void testUnsafeCall5() throws Exception { + runTest("idea/testData/quickfix/expressions/unsafeCall5.kt"); + } + + @TestMetadata("uselessCastStaticAssertIsFine.kt") + public void testUselessCastStaticAssertIsFine() throws Exception { + runTest("idea/testData/quickfix/expressions/uselessCastStaticAssertIsFine.kt"); + } + + @TestMetadata("uselessElvis.kt") + public void testUselessElvis() throws Exception { + runTest("idea/testData/quickfix/expressions/uselessElvis.kt"); + } + } + @TestMetadata("idea/testData/quickfix/lateinit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -686,6 +869,114 @@ public class HighLevelQuickFixTestGenerated extends AbstractHighLevelQuickFixTes } } + @TestMetadata("idea/testData/quickfix/replaceWithSafeCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ReplaceWithSafeCall extends AbstractHighLevelQuickFixTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInReplaceWithSafeCall() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/replaceWithSafeCall"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true); + } + + @TestMetadata("apply.kt") + public void testApply() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/apply.kt"); + } + + @TestMetadata("applyWithImplicitParameter.kt") + public void testApplyWithImplicitParameter() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameter.kt"); + } + + @TestMetadata("applyWithImplicitParameterFunctionCall.kt") + public void testApplyWithImplicitParameterFunctionCall() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt"); + } + + @TestMetadata("assignment.kt") + public void testAssignment() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/assignment.kt"); + } + + @TestMetadata("assignmentFromImplicitParameter.kt") + public void testAssignmentFromImplicitParameter() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentFromImplicitParameter.kt"); + } + + @TestMetadata("assignmentToNullable.kt") + public void testAssignmentToNullable() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentToNullable.kt"); + } + + @TestMetadata("assignmentToProperty.kt") + public void testAssignmentToProperty() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/assignmentToProperty.kt"); + } + + @TestMetadata("comment.kt") + public void testComment() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/comment.kt"); + } + + @TestMetadata("expression.kt") + public void testExpression() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/expression.kt"); + } + + @TestMetadata("extFunction.kt") + public void testExtFunction() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/extFunction.kt"); + } + + @TestMetadata("functionCall.kt") + public void testFunctionCall() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/functionCall.kt"); + } + + @TestMetadata("hasElvis.kt") + public void testHasElvis() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/hasElvis.kt"); + } + + @TestMetadata("hasElvis2.kt") + public void testHasElvis2() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/hasElvis2.kt"); + } + + @TestMetadata("invokeOperator.kt") + public void testInvokeOperator() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/invokeOperator.kt"); + } + + @TestMetadata("let.kt") + public void testLet() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/let.kt"); + } + + @TestMetadata("letWithParameter.kt") + public void testLetWithParameter() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/letWithParameter.kt"); + } + + @TestMetadata("lineBreak.kt") + public void testLineBreak() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/lineBreak.kt"); + } + + @TestMetadata("noReplaceWithSafeCallForImplicitReceiver.kt") + public void testNoReplaceWithSafeCallForImplicitReceiver() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt"); + } + + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("idea/testData/quickfix/replaceWithSafeCall/normal.kt"); + } + } + @TestMetadata("idea/testData/quickfix/variables/changeMutability") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt b/idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt index 1fe4c8366b0..154c200f5b9 100644 --- a/idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt +++ b/idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt @@ -11,3 +11,4 @@ fun foo() { val test: Some? = Some() for (i in test) { } } +/* FIR_COMPARISON */ diff --git a/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt b/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt index 200ddffeb87..22c0a973fcd 100644 --- a/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt +++ b/idea/testData/quickfix/replaceWithSafeCall/noReplaceWithSafeCallForImplicitReceiver.kt @@ -10,4 +10,5 @@ class A { fun A?.bar() { foo() -} \ No newline at end of file +} +/* FIR_COMPARISON */ \ No newline at end of file