diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/intentions/AbstractHLIntentionTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/intentions/AbstractHLIntentionTest.kt index 884387b470c..aa67d98cdfd 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/intentions/AbstractHLIntentionTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/intentions/AbstractHLIntentionTest.kt @@ -12,6 +12,12 @@ import java.io.File abstract class AbstractHLIntentionTest : AbstractIntentionTest() { override fun intentionFileName() = ".firIntention" + + override fun afterFileNameSuffix(ktFilePath: File): String { + return if (ktFilePath.resolveSibling(ktFilePath.name + AFTER_FIR_EXTENSION).exists()) AFTER_FIR_EXTENSION + else super.afterFileNameSuffix(ktFilePath) + } + override fun isFirPlugin() = true override fun doTestFor(mainFile: File, pathToFiles: Map, intentionAction: IntentionAction, fileText: String) { @@ -22,4 +28,8 @@ abstract class AbstractHLIntentionTest : AbstractIntentionTest() { override fun checkForErrorsAfter(fileText: String) {} override fun checkForErrorsBefore(fileText: String) {} + + companion object { + private const val AFTER_FIR_EXTENSION = ".after.fir" + } } \ No newline at end of file diff --git a/idea/testData/intentions/specifyTypeExplicitly/innerTypeParameter.kt.after.fir b/idea/testData/intentions/specifyTypeExplicitly/innerTypeParameter.kt.after.fir new file mode 100644 index 00000000000..6c187205bd9 --- /dev/null +++ b/idea/testData/intentions/specifyTypeExplicitly/innerTypeParameter.kt.after.fir @@ -0,0 +1,9 @@ +class A +class B +class C +class D +class E +private fun test(): () -> C, out B>>>> = { + class Local + C, B>>>>() +} \ No newline at end of file diff --git a/idea/testData/intentions/specifyTypeExplicitly/localClassInSecondTypeParameter.kt.after.fir b/idea/testData/intentions/specifyTypeExplicitly/localClassInSecondTypeParameter.kt.after.fir new file mode 100644 index 00000000000..68604b27263 --- /dev/null +++ b/idea/testData/intentions/specifyTypeExplicitly/localClassInSecondTypeParameter.kt.after.fir @@ -0,0 +1,6 @@ +class F +class TestClass +private fun test(): () -> TestClass = { + class Local + TestClass() +} \ No newline at end of file diff --git a/idea/testData/intentions/specifyTypeExplicitly/localClassInTypeParameter.kt.after.fir b/idea/testData/intentions/specifyTypeExplicitly/localClassInTypeParameter.kt.after.fir new file mode 100644 index 00000000000..c005d75915c --- /dev/null +++ b/idea/testData/intentions/specifyTypeExplicitly/localClassInTypeParameter.kt.after.fir @@ -0,0 +1,5 @@ +class TestClass +private fun test(): () -> TestClass = { + class Local + TestClass() +} \ No newline at end of file diff --git a/idea/testData/intentions/specifyTypeExplicitly/outClass2.kt.after.fir b/idea/testData/intentions/specifyTypeExplicitly/outClass2.kt.after.fir new file mode 100644 index 00000000000..0e4e2f1d906 --- /dev/null +++ b/idea/testData/intentions/specifyTypeExplicitly/outClass2.kt.after.fir @@ -0,0 +1,8 @@ +open class F +class B +class K + +private fun check(): () -> B> = { + class Local : F() + B>() +} \ No newline at end of file diff --git a/idea/testData/intentions/specifyTypeExplicitly/outClass3.kt.after.fir b/idea/testData/intentions/specifyTypeExplicitly/outClass3.kt.after.fir new file mode 100644 index 00000000000..a1b183155dc --- /dev/null +++ b/idea/testData/intentions/specifyTypeExplicitly/outClass3.kt.after.fir @@ -0,0 +1,8 @@ +open class F +class B +class K + +private fun check(): () -> B> = { + class Local : F() + B>() +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt index 553e89c28cf..0f6c6b125db 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.Assert import java.io.File +import java.nio.file.Path import java.util.* import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit @@ -39,7 +40,7 @@ import java.util.concurrent.TimeUnit abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() { protected open fun intentionFileName(): String = ".intention" - protected open fun afterFileNameSuffix(): String = ".after" + protected open fun afterFileNameSuffix(ktFilePath: File): String = ".after" protected open fun isApplicableDirectiveName(): String = "IS_APPLICABLE" @@ -193,7 +194,7 @@ abstract class AbstractIntentionTest : KotlinLightCodeInsightFixtureTestCase() { // Don't bother checking if it should have failed. if (shouldFailString.isEmpty()) { for ((filePath, value) in pathToFiles) { - val canonicalPathToExpectedFile = filePath + afterFileNameSuffix() + val canonicalPathToExpectedFile = filePath + afterFileNameSuffix(mainFile) if (filePath == mainFilePath) { try { myFixture.checkResultByFile(canonicalPathToExpectedFile) diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest2.kt b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest2.kt index 1846a7cf07d..16700ee307d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest2.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/AbstractIntentionTest2.kt @@ -5,9 +5,11 @@ package org.jetbrains.kotlin.idea.intentions +import java.io.File + abstract class AbstractIntentionTest2 : AbstractIntentionTest() { override fun intentionFileName() = ".intention2" - override fun afterFileNameSuffix() = ".after2" + override fun afterFileNameSuffix(ktFilePath: File) = ".after2" override fun intentionTextDirectiveName() = "INTENTION_TEXT_2" override fun isApplicableDirectiveName() = "IS_APPLICABLE_2" }