diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 4e3aa1d473e..ffead014e38 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -1177,6 +1177,7 @@ fun main(args: Array) { model("quickfix/variables/changeMutability", pattern = pattern, filenameStartsLowerCase = true) model("quickfix/addInitializer", pattern = pattern, filenameStartsLowerCase = true) model("quickfix/addPropertyAccessors", pattern = pattern, filenameStartsLowerCase = true) + model("quickfix/when", pattern = pattern, filenameStartsLowerCase = true) } testClass { diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/quickfix/MainKtQuickFixRegistrar.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/quickfix/MainKtQuickFixRegistrar.kt index 48af829459c..2c082fbdbf7 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/quickfix/MainKtQuickFixRegistrar.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/quickfix/MainKtQuickFixRegistrar.kt @@ -97,6 +97,9 @@ class MainKtQuickFixRegistrar : KtQuickFixRegistrar() { registerPsiQuickFixes(KtFirDiagnostic.UnnecessarySafeCall::class, ReplaceWithDotCallFix) registerPsiQuickFixes(KtFirDiagnostic.UnnecessaryNotNullAssertion::class, RemoveExclExclCallFix) registerApplicator(ReplaceCallFixFactories.unsafeCallFactory) + + // TODO: NON_EXHAUSTIVE_WHEN[_ON_SEALED_CLASS] will be replaced in future. We need to register the fix for those diagnostics as well + registerPsiQuickFixes(KtFirDiagnostic.NoElseInWhen::class, AddWhenElseBranchFix) } override val list: KtQuickFixesList = KtQuickFixesList.createCombined( 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 da6d6dae053..c23d5c11498 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 @@ -1311,4 +1311,157 @@ public class HighLevelQuickFixTestGenerated extends AbstractHighLevelQuickFixTes runTest("idea/testData/quickfix/addPropertyAccessors/varHasSetter.kt"); } } + + @TestMetadata("idea/testData/quickfix/when") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class When extends AbstractHighLevelQuickFixTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("addElseBranchEnumStatement.kt") + public void testAddElseBranchEnumStatement() throws Exception { + runTest("idea/testData/quickfix/when/addElseBranchEnumStatement.kt"); + } + + @TestMetadata("addRemainingBranchesBlankLine.kt") + public void testAddRemainingBranchesBlankLine() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt"); + } + + @TestMetadata("addRemainingBranchesBlankLineWithComment.kt") + public void testAddRemainingBranchesBlankLineWithComment() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt"); + } + + @TestMetadata("addRemainingBranchesBoolean.kt") + public void testAddRemainingBranchesBoolean() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesBoolean.kt"); + } + + @TestMetadata("addRemainingBranchesEnum.kt") + public void testAddRemainingBranchesEnum() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnum.kt"); + } + + @TestMetadata("addRemainingBranchesEnumBackTicks.kt") + public void testAddRemainingBranchesEnumBackTicks() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt"); + } + + @TestMetadata("addRemainingBranchesEnumImport1.kt") + public void testAddRemainingBranchesEnumImport1() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt"); + } + + @TestMetadata("addRemainingBranchesEnumImport2.kt") + public void testAddRemainingBranchesEnumImport2() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt"); + } + + @TestMetadata("addRemainingBranchesEnumImport3.kt") + public void testAddRemainingBranchesEnumImport3() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt"); + } + + @TestMetadata("addRemainingBranchesEnumImport4.kt") + public void testAddRemainingBranchesEnumImport4() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt"); + } + + @TestMetadata("addRemainingBranchesEnumStatement.kt") + public void testAddRemainingBranchesEnumStatement() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt"); + } + + @TestMetadata("addRemainingBranchesInNonDefaultPackage.kt") + public void testAddRemainingBranchesInNonDefaultPackage() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt"); + } + + @TestMetadata("addRemainingBranchesSealed.kt") + public void testAddRemainingBranchesSealed() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesSealed.kt"); + } + + @TestMetadata("addRemainingBranchesSealedBackTicks.kt") + public void testAddRemainingBranchesSealedBackTicks() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt"); + } + + @TestMetadata("addRemainingBranchesSealedStatement.kt") + public void testAddRemainingBranchesSealedStatement() throws Exception { + runTest("idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt"); + } + + public void testAllFilesPresentInWhen() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/quickfix/when"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), null, true); + } + + @TestMetadata("breakInWhen.kt") + public void testBreakInWhen() throws Exception { + runTest("idea/testData/quickfix/when/breakInWhen.kt"); + } + + @TestMetadata("breakInWhenInLabeled.kt") + public void testBreakInWhenInLabeled() throws Exception { + runTest("idea/testData/quickfix/when/breakInWhenInLabeled.kt"); + } + + @TestMetadata("commasInConditionWithNoArguments.kt") + public void testCommasInConditionWithNoArguments() throws Exception { + runTest("idea/testData/quickfix/when/commasInConditionWithNoArguments.kt"); + } + + @TestMetadata("commasInConditionWithNoArguments2.kt") + public void testCommasInConditionWithNoArguments2() throws Exception { + runTest("idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt"); + } + + @TestMetadata("continueInWhen.kt") + public void testContinueInWhen() throws Exception { + runTest("idea/testData/quickfix/when/continueInWhen.kt"); + } + + @TestMetadata("continueInWhenInLabeled.kt") + public void testContinueInWhenInLabeled() throws Exception { + runTest("idea/testData/quickfix/when/continueInWhenInLabeled.kt"); + } + + @TestMetadata("continueInWhenWithLabel.kt") + public void testContinueInWhenWithLabel() throws Exception { + runTest("idea/testData/quickfix/when/continueInWhenWithLabel.kt"); + } + + @TestMetadata("elseNotLastInWhen.kt") + public void testElseNotLastInWhen() throws Exception { + runTest("idea/testData/quickfix/when/elseNotLastInWhen.kt"); + } + + @TestMetadata("noElseInWhenWithBranches.kt") + public void testNoElseInWhenWithBranches() throws Exception { + runTest("idea/testData/quickfix/when/noElseInWhenWithBranches.kt"); + } + + @TestMetadata("noElseInWhenWithoutBranches.kt") + public void testNoElseInWhenWithoutBranches() throws Exception { + runTest("idea/testData/quickfix/when/noElseInWhenWithoutBranches.kt"); + } + + @TestMetadata("removeRedundantBranch.kt") + public void testRemoveRedundantBranch() throws Exception { + runTest("idea/testData/quickfix/when/removeRedundantBranch.kt"); + } + + @TestMetadata("removeRedundantElse.kt") + public void testRemoveRedundantElse() throws Exception { + runTest("idea/testData/quickfix/when/removeRedundantElse.kt"); + } + + @TestMetadata("twoElseBranchesInWhen.kt") + public void testTwoElseBranchesInWhen() throws Exception { + runTest("idea/testData/quickfix/when/twoElseBranchesInWhen.kt"); + } + } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt similarity index 59% rename from idea/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt rename to idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt index c9b6ee753e2..f55e5ccb1b9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt +++ b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/quickfix/AddWhenElseBranchFix.kt @@ -1,25 +1,15 @@ /* - * 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. + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.quickfix import com.intellij.codeInsight.CodeInsightUtilCore +import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.diagnostics.Diagnostic +import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtPsiFactory @@ -28,7 +18,7 @@ import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType -class AddWhenElseBranchFix(element: KtWhenExpression) : KotlinQuickFixAction(element) { +class AddWhenElseBranchFix(element: KtWhenExpression) : KotlinPsiOnlyQuickFixAction(element) { override fun getFamilyName() = KotlinBundle.message("fix.add.else.branch.when") override fun getText() = familyName @@ -49,9 +39,9 @@ class AddWhenElseBranchFix(element: KtWhenExpression) : KotlinQuickFixAction()?.let(::AddWhenElseBranchFix) + companion object : QuickFixesPsiBasedFactory(PsiElement::class, PsiElementSuitabilityCheckers.ALWAYS_SUITABLE) { + override fun doCreateQuickFix(psiElement: PsiElement): List { + return listOfNotNull(psiElement.getNonStrictParentOfType()?.let(::AddWhenElseBranchFix)) } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index 5fdad842189..08bd80e0791 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -25,7 +25,10 @@ import org.jetbrains.kotlin.idea.inspections.AddModifierFixFactory import org.jetbrains.kotlin.idea.inspections.InfixCallFixActionFactory import org.jetbrains.kotlin.idea.inspections.PlatformUnresolvedProvider import org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix -import org.jetbrains.kotlin.idea.intentions.* +import org.jetbrains.kotlin.idea.intentions.AddAccessorsIntention +import org.jetbrains.kotlin.idea.intentions.AddValVarToConstructorParameterAction +import org.jetbrains.kotlin.idea.intentions.ConvertPropertyInitializerToGetterIntention +import org.jetbrains.kotlin.idea.intentions.MoveMemberToCompanionObjectIntention import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.* import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromCallWithConstructorCalleeActionFactory import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createClass.CreateClassFromConstructorCallActionFactory diff --git a/idea/testData/quickfix/when/addElseBranchEnumStatement.kt b/idea/testData/quickfix/when/addElseBranchEnumStatement.kt index 732d403cc3e..b8a23abd611 100644 --- a/idea/testData/quickfix/when/addElseBranchEnumStatement.kt +++ b/idea/testData/quickfix/when/addElseBranchEnumStatement.kt @@ -7,3 +7,4 @@ fun use(c: Color) { } fun red() {} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addElseBranchEnumStatement.kt.after b/idea/testData/quickfix/when/addElseBranchEnumStatement.kt.after index ef96420640c..aeee59832e0 100644 --- a/idea/testData/quickfix/when/addElseBranchEnumStatement.kt.after +++ b/idea/testData/quickfix/when/addElseBranchEnumStatement.kt.after @@ -8,3 +8,4 @@ fun use(c: Color) { } fun red() {} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt b/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt index 1e2aa5103a7..fa130051f39 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt @@ -8,4 +8,5 @@ fun test(a: A) { val r = when (a) { } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt.after b/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt.after index 24224cf3fb7..89d7f642ab9 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesBlankLine.kt.after @@ -8,4 +8,5 @@ fun test(a: A) { val r = when (a) { is B -> TODO() } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt b/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt index 56ed09eb019..95bf695da84 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt @@ -10,4 +10,5 @@ fun test(a: A) { // comment } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt.after b/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt.after index f235164b968..fc055ed9a4c 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesBlankLineWithComment.kt.after @@ -10,4 +10,5 @@ fun test(a: A) { // comment is B -> TODO() } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt b/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt index bc8e9e031cc..8db52715695 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt @@ -3,3 +3,4 @@ fun test(b: Boolean) = when(b) { false -> 0 } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt.after b/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt.after index 9f9f71c7a01..f1a9354db48 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesBoolean.kt.after @@ -4,3 +4,4 @@ fun test(b: Boolean) = when(b) { false -> 0 true -> TODO() } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnum.kt b/idea/testData/quickfix/when/addRemainingBranchesEnum.kt index 477ec32bb25..64de4869b5a 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnum.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnum.kt @@ -5,3 +5,4 @@ enum class Color { R, G, B } fun test(c: Color) = when(c) { Color.B -> 0xff } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnum.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnum.kt.after index 28b04c4c7ee..fa586998b4b 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnum.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnum.kt.after @@ -7,3 +7,4 @@ fun test(c: Color) = when(c) { Color.R -> TODO() Color.G -> TODO() } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt index 8ff899d64eb..a1f35554a04 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt @@ -7,4 +7,5 @@ enum class FooEnum { fun test(foo: FooEnum?) = when (foo) { FooEnum.A -> "A" -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt.after index 4497f9cd83c..b0c6804a866 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumBackTicks.kt.after @@ -13,4 +13,5 @@ fun test(foo: FooEnum?) = when (foo) { FooEnum.`false` -> TODO() FooEnum.`null` -> TODO() null -> TODO() -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt index cefde7f5ded..91629ae019d 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt @@ -10,3 +10,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt.after index e75492e0ffc..14743b8decd 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport1.kt.after @@ -15,3 +15,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt index e72ae5f241e..a2f011058fa 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt @@ -13,3 +13,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt.after index 434c7c8dcc3..2ddedeb682e 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport2.kt.after @@ -14,3 +14,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt index 18aff34f34c..6a6885b4d47 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt @@ -23,3 +23,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt.after index 3232e16e7a5..808951c189e 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport3.kt.after @@ -26,3 +26,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt index 368b3914336..7d1881e2879 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt @@ -23,3 +23,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt.after index 0b735aae769..39a4f1a71f6 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumImport4.kt.after @@ -28,3 +28,4 @@ class Test { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt b/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt index ee6ebd049f8..f7716cb8b98 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt @@ -9,3 +9,4 @@ fun use(c: Color) { } fun red() {} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt.after b/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt.after index e473a6374c9..b14572df419 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesEnumStatement.kt.after @@ -11,3 +11,4 @@ fun use(c: Color) { } fun red() {} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt b/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt index ed81538bb48..48c61f341a1 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt @@ -6,3 +6,4 @@ enum class Color { R, G, B } fun test(c: Color) = when(c) { Color.B -> 0xff } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt.after b/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt.after index 6c5cc283db7..32ae79c9eac 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesInNonDefaultPackage.kt.after @@ -8,3 +8,4 @@ fun test(c: Color) = when(c) { Color.R -> TODO() Color.G -> TODO() } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealed.kt b/idea/testData/quickfix/when/addRemainingBranchesSealed.kt index 199276d3064..211f55ca507 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealed.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesSealed.kt @@ -12,3 +12,4 @@ sealed class Variant { fun test(v: Variant?) = when(v) { Variant.Singleton -> "s" } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealed.kt.after b/idea/testData/quickfix/when/addRemainingBranchesSealed.kt.after index ef3d03c8d8c..4fec84ca061 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealed.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesSealed.kt.after @@ -15,3 +15,4 @@ fun test(v: Variant?) = when(v) { is Variant.Something -> TODO() null -> TODO() } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt b/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt index 2ed61b520bf..508848d44a6 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt @@ -12,4 +12,5 @@ object `null`: FooSealed() fun test(foo: FooSealed?) = when (foo) { A -> "A" -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt.after b/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt.after index 67407e074bd..776c2bab778 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesSealedBackTicks.kt.after @@ -19,4 +19,5 @@ fun test(foo: FooSealed?) = when (foo) { `null` -> TODO() is `true` -> TODO() null -> TODO() -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt b/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt index c2160d2ec5d..8c7ac46ab04 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt +++ b/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt @@ -14,3 +14,4 @@ fun test(v: Variant?) { Variant.Singleton -> "s" } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt.after b/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt.after index 6456b3bf9e5..4d9e726079f 100644 --- a/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt.after +++ b/idea/testData/quickfix/when/addRemainingBranchesSealedStatement.kt.after @@ -17,3 +17,4 @@ fun test(v: Variant?) { null -> TODO() } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/breakInWhen.kt b/idea/testData/quickfix/when/breakInWhen.kt index 3dc67a92809..885e71e4909 100644 --- a/idea/testData/quickfix/when/breakInWhen.kt +++ b/idea/testData/quickfix/when/breakInWhen.kt @@ -16,3 +16,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/breakInWhen.kt.after b/idea/testData/quickfix/when/breakInWhen.kt.after index f9b34c5ba03..88d5ffdebc8 100644 --- a/idea/testData/quickfix/when/breakInWhen.kt.after +++ b/idea/testData/quickfix/when/breakInWhen.kt.after @@ -16,3 +16,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/breakInWhenInLabeled.kt b/idea/testData/quickfix/when/breakInWhenInLabeled.kt index 1edc2c7abf0..c0b6fa731e1 100644 --- a/idea/testData/quickfix/when/breakInWhenInLabeled.kt +++ b/idea/testData/quickfix/when/breakInWhenInLabeled.kt @@ -12,4 +12,5 @@ fun foo(chars: CharArray) { } pos++ } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/breakInWhenInLabeled.kt.after b/idea/testData/quickfix/when/breakInWhenInLabeled.kt.after index 9187fd27ae9..035b5ac9d6e 100644 --- a/idea/testData/quickfix/when/breakInWhenInLabeled.kt.after +++ b/idea/testData/quickfix/when/breakInWhenInLabeled.kt.after @@ -12,4 +12,5 @@ fun foo(chars: CharArray) { } pos++ } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt b/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt index 9967424c9a9..fc3a0abe7aa 100644 --- a/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt +++ b/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt @@ -8,4 +8,5 @@ fun test(i: Int, j: Int) { i < 0, j < 0, j > i -> { /* code 4 */ } else -> { /* other code */ } } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt.after b/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt.after index 49cb116ac7b..15e01b5aeec 100644 --- a/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt.after +++ b/idea/testData/quickfix/when/commasInConditionWithNoArguments.kt.after @@ -8,4 +8,5 @@ fun test(i: Int, j: Int) { i < 0 || j < 0 || j > i -> { /* code 4 */ } else -> { /* other code */ } } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt b/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt index 7991e30c837..da51791c6ee 100644 --- a/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt +++ b/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt @@ -5,4 +5,5 @@ fun test(a: Boolean, b: Boolean, c: Boolean) { c -> "b" else -> "e" } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt.after b/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt.after index 5b55bd2e79d..a49eefcd20f 100644 --- a/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt.after +++ b/idea/testData/quickfix/when/commasInConditionWithNoArguments2.kt.after @@ -5,4 +5,5 @@ fun test(a: Boolean, b: Boolean, c: Boolean) { c -> "b" else -> "e" } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhen.kt b/idea/testData/quickfix/when/continueInWhen.kt index aa5faadadb5..21c227bc94d 100644 --- a/idea/testData/quickfix/when/continueInWhen.kt +++ b/idea/testData/quickfix/when/continueInWhen.kt @@ -16,3 +16,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhen.kt.after b/idea/testData/quickfix/when/continueInWhen.kt.after index 1a0b22fd813..564221664be 100644 --- a/idea/testData/quickfix/when/continueInWhen.kt.after +++ b/idea/testData/quickfix/when/continueInWhen.kt.after @@ -16,3 +16,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhenInLabeled.kt b/idea/testData/quickfix/when/continueInWhenInLabeled.kt index 64349f409bb..611ddf250e8 100644 --- a/idea/testData/quickfix/when/continueInWhenInLabeled.kt +++ b/idea/testData/quickfix/when/continueInWhenInLabeled.kt @@ -12,4 +12,5 @@ fun foo(chars: CharArray) { } pos++ } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhenInLabeled.kt.after b/idea/testData/quickfix/when/continueInWhenInLabeled.kt.after index 2ad223c90fe..23a0d0d0f03 100644 --- a/idea/testData/quickfix/when/continueInWhenInLabeled.kt.after +++ b/idea/testData/quickfix/when/continueInWhenInLabeled.kt.after @@ -12,4 +12,5 @@ fun foo(chars: CharArray) { } pos++ } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhenWithLabel.kt b/idea/testData/quickfix/when/continueInWhenWithLabel.kt index c7cf6a31ad4..0e1656ed21c 100644 --- a/idea/testData/quickfix/when/continueInWhenWithLabel.kt +++ b/idea/testData/quickfix/when/continueInWhenWithLabel.kt @@ -18,3 +18,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/continueInWhenWithLabel.kt.after b/idea/testData/quickfix/when/continueInWhenWithLabel.kt.after index 7013b98e934..affda9eafbf 100644 --- a/idea/testData/quickfix/when/continueInWhenWithLabel.kt.after +++ b/idea/testData/quickfix/when/continueInWhenWithLabel.kt.after @@ -18,3 +18,4 @@ fun breakContinueInWhen(i: Int) { } } } +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/elseNotLastInWhen.kt b/idea/testData/quickfix/when/elseNotLastInWhen.kt index eb027b40815..6c944af3542 100644 --- a/idea/testData/quickfix/when/elseNotLastInWhen.kt +++ b/idea/testData/quickfix/when/elseNotLastInWhen.kt @@ -6,4 +6,5 @@ fun test() { else -> { /* other code */ } 2 -> { /* some more code */ } } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/elseNotLastInWhen.kt.after b/idea/testData/quickfix/when/elseNotLastInWhen.kt.after index 48bd88fcd36..a2f42fa244e 100644 --- a/idea/testData/quickfix/when/elseNotLastInWhen.kt.after +++ b/idea/testData/quickfix/when/elseNotLastInWhen.kt.after @@ -6,4 +6,5 @@ fun test() { 2 -> { /* some more code */ } else -> { /* other code */ } } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/removeRedundantBranch.kt b/idea/testData/quickfix/when/removeRedundantBranch.kt index c76cf65a675..fbbaebaab27 100644 --- a/idea/testData/quickfix/when/removeRedundantBranch.kt +++ b/idea/testData/quickfix/when/removeRedundantBranch.kt @@ -6,4 +6,5 @@ fun test(x: Int): String { null -> "null" else -> "" } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/removeRedundantBranch.kt.after b/idea/testData/quickfix/when/removeRedundantBranch.kt.after index 08cb050bc84..cb85ea1ed4c 100644 --- a/idea/testData/quickfix/when/removeRedundantBranch.kt.after +++ b/idea/testData/quickfix/when/removeRedundantBranch.kt.after @@ -5,4 +5,5 @@ fun test(x: Int): String { 2 -> "2" else -> "" } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/removeRedundantElse.kt b/idea/testData/quickfix/when/removeRedundantElse.kt index d9e65c9e7f0..d5878f12c47 100644 --- a/idea/testData/quickfix/when/removeRedundantElse.kt +++ b/idea/testData/quickfix/when/removeRedundantElse.kt @@ -6,4 +6,5 @@ fun foo(b: Boolean) { false -> {} else -> error() } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/removeRedundantElse.kt.after b/idea/testData/quickfix/when/removeRedundantElse.kt.after index 0bec99fd674..86a2b819b7f 100644 --- a/idea/testData/quickfix/when/removeRedundantElse.kt.after +++ b/idea/testData/quickfix/when/removeRedundantElse.kt.after @@ -5,4 +5,5 @@ fun foo(b: Boolean) { true -> return false -> {} } -} \ No newline at end of file +} +/* IGNORE_FIR */ diff --git a/idea/testData/quickfix/when/twoElseBranchesInWhen.kt b/idea/testData/quickfix/when/twoElseBranchesInWhen.kt index 30447110c8a..11b7ead5503 100644 --- a/idea/testData/quickfix/when/twoElseBranchesInWhen.kt +++ b/idea/testData/quickfix/when/twoElseBranchesInWhen.kt @@ -14,3 +14,4 @@ fun foo() { 3 -> { /* some other code */ } } } +/* IGNORE_FIR */