From d8336f6b22955ced48b85aaddadc09c7fad5d974 Mon Sep 17 00:00:00 2001 From: Frederik Haselmeier Date: Sat, 8 Feb 2025 08:44:21 +0100 Subject: [PATCH] [kotlin] Fixed tests to work with Kotlin 2.1 KTIJ-32943 GitOrigin-RevId: 41af496b58fb5b77fe2cb301fc0a145557fba0f8 --- .../kotlin.compiler-reference-index.tests.iml | 1 + .../search/refIndex/KotlinCompilerRefHelperTest.kt | 14 ++++++++++++++ .../KotlinCompilerReferenceMultiModuleTest.kt | 7 +++++++ .../nestedPrimaryConstructor/testConfig.fir.json | 9 +++++++++ .../overrideImplement/genericSuperClass.kt | 12 ++++++------ .../overrideImplement/genericSuperClass.kt.after | 12 ++++++------ .../ifThenToElvis/nullCheckWithSelectorCall.kt | 2 +- .../nullCheckWithSelectorCall.kt.after | 2 +- .../nullCheckWithSelectorCallChain.kt | 2 +- .../nullCheckWithSelectorCallChain.kt.after | 2 +- .../nullCheckWithSelectorCallChain.kt | 2 +- .../nullCheckWithSelectorCallChain.kt.after | 2 +- .../callInsideEnumWithCast.kt | 1 - .../callInsideEnumWithCast.kt.after | 2 -- .../callInsideEnumWithoutCast.kt | 1 - .../callInsideEnumWithoutCast.kt.after | 2 -- .../forEachInsideEnumBody.kt | 1 - .../forEachInsideEnumBody.kt.after | 2 -- .../removeExplicitTypeArguments/ktij-24539.kt | 4 +++- .../replaceWithIgnoreCaseEquals/extension.kt | 2 ++ .../replaceWithIgnoreCaseEquals/extension.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/extension2.kt | 2 ++ .../extension2.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/notApplicable.kt | 2 ++ .../replaceWithIgnoreCaseEquals/notApplicable2.kt | 1 + .../replaceWithIgnoreCaseEquals/notApplicable3.kt | 1 + .../replaceWithIgnoreCaseEquals/notApplicable4.kt | 2 ++ .../replaceWithIgnoreCaseEquals/nullable.kt | 2 ++ .../replaceWithIgnoreCaseEquals/nullable.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/nullable2.kt | 2 ++ .../replaceWithIgnoreCaseEquals/nullable2.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/nullable3.kt | 2 ++ .../replaceWithIgnoreCaseEquals/nullable3.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/toLowerCase.kt | 2 ++ .../toLowerCase.kt.after | 2 ++ .../replaceWithIgnoreCaseEquals/toUpperCase.kt | 2 ++ .../toUpperCase.kt.after | 2 ++ .../necessaryFileOptInWithSubclassOptInRequired.kt | 1 - .../necessaryOptInWithSubclassOptInRequired.kt | 1 - .../inspectionsLocal/unusedSymbol/typeAlias.kt | 1 + .../addExclExclCall/implicitFunctionCall.kt | 4 ++-- .../addExclExclCall/implicitFunctionCall.kt.after | 4 ++-- ...avaNullabilityMismatchWithImplicitReceiver.test | 2 ++ .../addExclExclCall/javaReceiverNullability1.test | 2 ++ .../addExclExclCall/javaReceiverNullability2.test | 2 ++ .../javaReceiverNullabilityInvoke.test | 2 ++ .../javaReceiverNullabilityProperty.test | 2 ++ .../javaReceiverNullabilityWithThisReceiver.test | 2 ++ .../testData/quickfix/addExclExclCall/normal2.kt | 2 +- .../quickfix/addExclExclCall/normal2.kt.after | 2 +- .../javaUpperBoundViolated.test | 2 ++ .../kotlinBrowserFullyQualifiedProperty.kt | 3 +++ .../kotlinBrowserFullyQualifiedProperty.kt.after | 3 +++ .../makeArgumentNonNullable.test | 2 ++ .../makeArgumentNullable.test | 2 ++ .../makeReturnValueNonNullable.test | 6 ++++-- .../quickfix/replaceWithDotCall/functionCall.kt | 2 +- .../replaceWithDotCall/functionCall.kt.after | 2 +- .../applyWithImplicitParameterFunctionCall.kt | 2 +- ...applyWithImplicitParameterFunctionCall.kt.after | 2 +- .../quickfix/replaceWithSafeCall/extFunction.kt | 2 +- .../replaceWithSafeCall/extFunction.kt.after | 2 +- .../quickfix/replaceWithSafeCall/functionCall.kt | 2 +- .../replaceWithSafeCall/functionCall.kt.after | 2 +- ...avaNullabilityMismatchWithImplicitReceiver.test | 2 ++ .../javaReceiverNullability1.test | 2 ++ .../javaReceiverNullability2.test | 2 ++ .../javaReceiverNullabilityArrayGet.test | 2 ++ .../javaReceiverNullabilityArraySet.test | 2 ++ .../javaReceiverNullabilityInfixPlus.test | 2 ++ .../javaReceiverNullabilityInvoke.test | 2 ++ .../javaReceiverNullabilityProperty.test | 2 ++ .../javaReceiverNullabilityWithThisReceiver.test | 2 ++ .../applyWithoutThisMethodCall.kt | 2 +- .../applyWithoutThisMethodCall.kt.after | 2 +- .../javaReceiverNullabilityAlso.test | 2 ++ .../javaReceiverNullabilityRunExplicitThis.test | 2 ++ .../javaNullabilityArgument.test | 2 ++ .../javaReceiverNullability.test | 2 ++ .../javaReceiverNullabilityInvoke.test | 2 ++ .../wrapWithSafeLetCall/extensionMethod.kt | 5 ++--- .../javaNullabilityMismatchArgument.test | 2 ++ .../javaNullabilityMismatchArgument2.test | 2 ++ .../javaNullabilityMismatchDoNotWrapNull.test | 1 + .../javaReceiverNullabilityInvoke.test | 2 ++ .../javaReceiverNullabilityInvoke2.test | 2 ++ 86 files changed, 170 insertions(+), 51 deletions(-) create mode 100644 plugins/kotlin/compiler-reference-index/tests/testData/compilerIndex/functions/constructors/nestedPrimaryConstructor/testConfig.fir.json diff --git a/plugins/kotlin/compiler-reference-index/tests/kotlin.compiler-reference-index.tests.iml b/plugins/kotlin/compiler-reference-index/tests/kotlin.compiler-reference-index.tests.iml index 9f9fd1e3568f..73bcb17def20 100644 --- a/plugins/kotlin/compiler-reference-index/tests/kotlin.compiler-reference-index.tests.iml +++ b/plugins/kotlin/compiler-reference-index/tests/kotlin.compiler-reference-index.tests.iml @@ -38,5 +38,6 @@ + \ No newline at end of file diff --git a/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerRefHelperTest.kt b/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerRefHelperTest.kt index d4a8194854cb..8fd010498342 100644 --- a/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerRefHelperTest.kt +++ b/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerRefHelperTest.kt @@ -6,7 +6,10 @@ import com.intellij.java.compiler.CompilerReferencesTestBase import com.intellij.psi.CommonClassNames import com.intellij.psi.util.descendantsOfType import com.intellij.testFramework.SkipSlowTestLocally +import com.intellij.testFramework.builders.JavaModuleFixtureBuilder import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode +import org.jetbrains.kotlin.idea.base.plugin.artifacts.KotlinArtifactNames +import org.jetbrains.kotlin.idea.base.plugin.artifacts.TestKotlinArtifacts import org.jetbrains.kotlin.idea.test.ExpectedPluginModeProvider import org.jetbrains.kotlin.idea.test.setUpWithKotlinPlugin import org.jetbrains.kotlin.psi.KtClass @@ -26,6 +29,17 @@ open class KotlinCompilerRefHelperTest : CompilerReferencesTestBase(), ExpectedP } } + override fun tuneFixture(moduleBuilder: JavaModuleFixtureBuilder<*>) { + super.tuneFixture(moduleBuilder) + if (pluginMode == KotlinPluginMode.K2) { + moduleBuilder.addLibrary(KotlinArtifactNames.KOTLIN_STDLIB, TestKotlinArtifacts.kotlinStdlib.path) + } else { + // For the K1 tests we want to use a Kotlin 1.x library because Kotlin 2 libraries might not be able to + // be consumed by the K1 compiler. + moduleBuilder.addMavenLibrary(JavaModuleFixtureBuilder.MavenLib("org.jetbrains.kotlin:kotlin-stdlib:1.9.25")) + } + } + fun `test dirty scope`() { installCompiler() val javaFile = myFixture.addFileToProject( diff --git a/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerReferenceMultiModuleTest.kt b/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerReferenceMultiModuleTest.kt index 9c938b148c6b..2fd9d6b40c10 100644 --- a/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerReferenceMultiModuleTest.kt +++ b/plugins/kotlin/compiler-reference-index/tests/test/org/jetbrains/kotlin/idea/search/refIndex/KotlinCompilerReferenceMultiModuleTest.kt @@ -3,6 +3,7 @@ package org.jetbrains.kotlin.idea.search.refIndex import com.intellij.openapi.module.JavaModuleType import com.intellij.openapi.module.Module +import com.intellij.openapi.roots.ModuleRootManager import com.intellij.openapi.roots.ModuleRootModificationUtil import com.intellij.pom.java.LanguageLevel import com.intellij.psi.CommonClassNames @@ -11,6 +12,7 @@ import com.intellij.testFramework.IdeaTestUtil import com.intellij.testFramework.PsiTestUtil import com.intellij.testFramework.SkipSlowTestLocally import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode +import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil @SkipSlowTestLocally open class KotlinCompilerReferenceMultiModuleTest : KotlinCompilerReferenceTestBase() { @@ -138,6 +140,11 @@ open class KotlinCompilerReferenceMultiModuleTest : KotlinCompilerReferenceTestB private fun createModule(moduleName: String): Module { val moduleDir = myFixture.tempDirFixture.findOrCreateDir(moduleName) val module = PsiTestUtil.addModule(project, JavaModuleType.getModuleType(), moduleName, moduleDir) + ModuleRootManager.getInstance(module)!!.modifiableModel.apply { + if (withK2Compiler) { + ConfigLibraryUtil.configureKotlinRuntime(module) + } + } IdeaTestUtil.setModuleLanguageLevel(module, LanguageLevel.JDK_11) return module } diff --git a/plugins/kotlin/compiler-reference-index/tests/testData/compilerIndex/functions/constructors/nestedPrimaryConstructor/testConfig.fir.json b/plugins/kotlin/compiler-reference-index/tests/testData/compilerIndex/functions/constructors/nestedPrimaryConstructor/testConfig.fir.json new file mode 100644 index 000000000000..4571be6b6292 --- /dev/null +++ b/plugins/kotlin/compiler-reference-index/tests/testData/compilerIndex/functions/constructors/nestedPrimaryConstructor/testConfig.fir.json @@ -0,0 +1,9 @@ +{ + "mainFile": "Foo.kt", + "usages": [ + "Doo.kt", + "Foo.kt", + "JavaClass.java", + "Main.kt" + ] +} diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt b/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt index eb85d55d9339..3d032143a2bb 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt @@ -32,10 +32,10 @@ abstract class X : java.util.ArrayList(), Runnable { // MEMBER_K1: "add(index: Int, element: String): Unit" // MEMBER_K1: "addAll(elements: Collection): Boolean" // MEMBER_K1: "addAll(index: Int, elements: Collection): Boolean" -// MEMBER_K1: "remove(element: String): Boolean" -// MEMBER_K1: "removeAll(elements: Collection): Boolean" -// MEMBER_K1: "retainAll(elements: Collection): Boolean" -// MEMBER_K1: "contains(element: String): Boolean" +// MEMBER_K1: "remove(element: String!): Boolean" +// MEMBER_K1: "removeAll(elements: Collection): Boolean" +// MEMBER_K1: "retainAll(elements: Collection): Boolean" +// MEMBER_K1: "contains(element: String!): Boolean" // MEMBER_K1: "containsAll(elements: Collection): Boolean" // MEMBER_K1: "forEach(p0: Consumer!): Unit" // MEMBER_K1: "spliterator(): Spliterator" @@ -49,8 +49,8 @@ abstract class X : java.util.ArrayList(), Runnable { // MEMBER_K1: "set(index: Int, element: String): String" // MEMBER_K1: "subList(fromIndex: Int, toIndex: Int): MutableList" // MEMBER_K1: "get(index: Int): String" -// MEMBER_K1: "indexOf(element: String): Int" -// MEMBER_K1: "lastIndexOf(element: String): Int" +// MEMBER_K1: "indexOf(element: String!): Int" +// MEMBER_K1: "lastIndexOf(element: String!): Int" // MEMBER_K1: "sort(p0: Comparator!): Unit" // MEMBER: "clear(): Unit" diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt.after b/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt.after index 04a74960cdba..d884cdd9c5de 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt.after +++ b/plugins/kotlin/idea/tests/testData/codeInsight/overrideImplement/genericSuperClass.kt.after @@ -34,10 +34,10 @@ abstract class X : java.util.ArrayList(), Runnable { // MEMBER_K1: "add(index: Int, element: String): Unit" // MEMBER_K1: "addAll(elements: Collection): Boolean" // MEMBER_K1: "addAll(index: Int, elements: Collection): Boolean" -// MEMBER_K1: "remove(element: String): Boolean" -// MEMBER_K1: "removeAll(elements: Collection): Boolean" -// MEMBER_K1: "retainAll(elements: Collection): Boolean" -// MEMBER_K1: "contains(element: String): Boolean" +// MEMBER_K1: "remove(element: String!): Boolean" +// MEMBER_K1: "removeAll(elements: Collection): Boolean" +// MEMBER_K1: "retainAll(elements: Collection): Boolean" +// MEMBER_K1: "contains(element: String!): Boolean" // MEMBER_K1: "containsAll(elements: Collection): Boolean" // MEMBER_K1: "forEach(p0: Consumer!): Unit" // MEMBER_K1: "spliterator(): Spliterator" @@ -51,8 +51,8 @@ abstract class X : java.util.ArrayList(), Runnable { // MEMBER_K1: "set(index: Int, element: String): String" // MEMBER_K1: "subList(fromIndex: Int, toIndex: Int): MutableList" // MEMBER_K1: "get(index: Int): String" -// MEMBER_K1: "indexOf(element: String): Int" -// MEMBER_K1: "lastIndexOf(element: String): Int" +// MEMBER_K1: "indexOf(element: String!): Int" +// MEMBER_K1: "lastIndexOf(element: String!): Int" // MEMBER_K1: "sort(p0: Comparator!): Unit" // MEMBER: "clear(): Unit" diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt index 2bb3d9b213f6..747c143ac6a6 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt @@ -3,7 +3,7 @@ val nullableString: String? = "abc" val foo = if (nullableString != null) { - nullableString.toUpperCase() + nullableString.uppercase() } else { "" } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt.after index d30fdade8213..230f25530e02 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCall.kt.after @@ -2,4 +2,4 @@ val nullableString: String? = "abc" -val foo = nullableString?.toUpperCase() ?: "" \ No newline at end of file +val foo = nullableString?.uppercase() ?: "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt index 4e10ab26f56a..567c0d922e1e 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt @@ -3,7 +3,7 @@ val nullableString: String? = "abc" val foo = if (nullableString != null) { - nullableString.toUpperCase().toLowerCase() + nullableString.uppercase().lowercase() } else { "" } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt.after index 62f4b69af2f9..fbebb809747b 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToElvis/nullCheckWithSelectorCallChain.kt.after @@ -2,4 +2,4 @@ val nullableString: String? = "abc" -val foo = nullableString?.toUpperCase()?.toLowerCase() ?: "" \ No newline at end of file +val foo = nullableString?.uppercase()?.lowercase() ?: "" \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt index 64998feb4161..5c7200a28ce6 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt @@ -3,7 +3,7 @@ val nullableString: String? = "abc" val foo = if (nullableString != null) { - nullableString.toUpperCase().toLowerCase() + nullableString.uppercase().lowercase() } else { null } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after index 7dd4f671a8c2..b6a52594bae4 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/branched/ifThenToSafeAccess/nullCheckWithSelectorCallChain.kt.after @@ -2,4 +2,4 @@ val nullableString: String? = "abc" -val foo = nullableString?.toUpperCase()?.toLowerCase() +val foo = nullableString?.uppercase()?.lowercase() diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt index 8f27e4980b65..de258fd0f171 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt @@ -8,4 +8,3 @@ enum class EnumClass { } } -// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt.after index de9c4a90f7f2..a52ef8348ff6 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithCast.kt.after @@ -7,5 +7,3 @@ enum class EnumClass { val v = entries.toTypedArray() } } - -// IGNORE_K2 diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt index ce208c5bb3f0..91496b662cc6 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt @@ -8,4 +8,3 @@ enum class EnumClass { } } -// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt.after index 7fe68601fb3a..1c964a5cda7f 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/callInsideEnumWithoutCast.kt.after @@ -7,5 +7,3 @@ enum class EnumClass { for (e in entries) {} } } - -// IGNORE_K2 diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt index a16dab3e769b..64e923851ddc 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt @@ -9,4 +9,3 @@ enum class EnumClass { } } -// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt.after index ae098b1b60a5..1524d9dde230 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/enumValuesSoftDeprecate/forEachInsideEnumBody.kt.after @@ -8,5 +8,3 @@ enum class EnumClass { entries.forEach {} } } - -// IGNORE_K2 diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/removeExplicitTypeArguments/ktij-24539.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/removeExplicitTypeArguments/ktij-24539.kt index 1ae35c109c85..42bb6cf7d480 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/removeExplicitTypeArguments/ktij-24539.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/removeExplicitTypeArguments/ktij-24539.kt @@ -19,4 +19,6 @@ fun main() { implicitOut { AImpl() } use { it.foo } } -} \ No newline at end of file +} + +// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt index b034d18cbb0e..28b86a417194 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun String.test(s: String): Boolean { return toLowerCase() == s.toLowerCase() } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt.after index 28c4e6696fd5..a0996a524d33 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun String.test(s: String): Boolean { return equals(s, ignoreCase = true) } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt index 488f9cdd9328..97414b668785 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun String.test(s: String): Boolean { return s.toLowerCase() == toLowerCase() } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt.after index 4d3f2809831b..ccb9f3fd4e27 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/extension2.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun String.test(s: String): Boolean { return s.equals(this, ignoreCase = true) } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable.kt index eb3f3388b50c..f8ea888604ea 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable.kt @@ -1,5 +1,7 @@ // PROBLEM: none // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String): Boolean { return a.toLowerCase() != b.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable2.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable2.kt index 72574965f13a..87f4ead7b27c 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable2.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable2.kt @@ -1,5 +1,6 @@ // PROBLEM: none // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String): Boolean { return a == b.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable3.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable3.kt index 88cbce65819f..55c855a96b1f 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable3.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable3.kt @@ -1,5 +1,6 @@ // PROBLEM: none // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String): Boolean { return a.toLowerCase() == b } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable4.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable4.kt index 81f6883a32dd..15b59e1dd569 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable4.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/notApplicable4.kt @@ -1,5 +1,7 @@ // PROBLEM: none // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toUpperCase(): String' is an error. Use uppercase() instead. fun test(a: String, b: String): Boolean { return a.toLowerCase() == b.toUpperCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt index f796b8add355..6f774ad5e5c0 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String?, b: String): Boolean { return a?.toLowerCase() == b.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt.after index 8136aa2ff70d..a6379c47d85b 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String?, b: String): Boolean { return a.equals(b, ignoreCase = true) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt index c9bb2f753429..00c904b0e9ed 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String?): Boolean { return a.toLowerCase() == b?.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt.after index 9f6581f54a42..c02fc3691dd7 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable2.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String?): Boolean { return a.equals(b, ignoreCase = true) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt index ee32e0f12780..9308499f7646 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String?, b: String?): Boolean { return a?.toLowerCase() == b?.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt.after index 320b342f8257..b5e5329073f2 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/nullable3.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String?, b: String?): Boolean { return a.equals(b, ignoreCase = true) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt index 5505fa45b5ee..4185ce9e62f7 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String): Boolean { return a.toLowerCase() == b.toLowerCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt.after index 0a220ddced1d..436b80e99ca8 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toLowerCase.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. +// ERROR: Using 'toLowerCase(): String' is an error. Use lowercase() instead. fun test(a: String, b: String): Boolean { return a.equals(b, ignoreCase = true) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt index d246d7c03826..366eb4cfd4d3 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toUpperCase(): String' is an error. Use uppercase() instead. +// ERROR: Using 'toUpperCase(): String' is an error. Use uppercase() instead. fun test(a: String, b: String): Boolean { return a.toUpperCase() == b.toUpperCase() } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt.after index 0a220ddced1d..15508c5de89b 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/replaceWithIgnoreCaseEquals/toUpperCase.kt.after @@ -1,4 +1,6 @@ // WITH_STDLIB +// ERROR: Using 'toUpperCase(): String' is an error. Use uppercase() instead. +// ERROR: Using 'toUpperCase(): String' is an error. Use uppercase() instead. fun test(a: String, b: String): Boolean { return a.equals(b, ignoreCase = true) } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryFileOptInWithSubclassOptInRequired.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryFileOptInWithSubclassOptInRequired.kt index 2e60ba279a2c..30771efb7679 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryFileOptInWithSubclassOptInRequired.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryFileOptInWithSubclassOptInRequired.kt @@ -1,6 +1,5 @@ // PROBLEM: none // WITH_STDLIB -// ERROR: Unresolved reference: SubclassOptInRequired @file:OptIn(UnstableApiA::class, UnstableApiB::class, ExperimentalSubclassOptIn::class) diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryOptInWithSubclassOptInRequired.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryOptInWithSubclassOptInRequired.kt index 3b16cabbb019..8d42f20347e1 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryOptInWithSubclassOptInRequired.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unnecessaryOptInAnnotation/necessaryOptInWithSubclassOptInRequired.kt @@ -6,7 +6,6 @@ // ERROR: This annotation is not repeatable // ERROR: This annotation is not repeatable // ERROR: This annotation is not repeatable -// ERROR: Unresolved reference: SubclassOptInRequired @file:OptIn(ExperimentalSubclassOptIn::class) diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unusedSymbol/typeAlias.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unusedSymbol/typeAlias.kt index d5158b1037a5..854a274dbf44 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/unusedSymbol/typeAlias.kt +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/unusedSymbol/typeAlias.kt @@ -1,4 +1,5 @@ // PROBLEM: none +// K2_ERROR: Cannot use typealias 'Other' as a callable qualifier in import. Use original class 'MyEnum' instead or rewrite calls with 'Other' as a qualifier. See https://youtrack.jetbrains.com/issue/KT-64431. import Other.HELLO diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt index 87a9e45efd47..c1ebf5d59040 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt @@ -1,7 +1,7 @@ -// "Add non-null asserted (toLowerCase()!!) call" "true" +// "Add non-null asserted (lowercase()!!) call" "true" // WITH_STDLIB fun String?.foo() { - toLowerCase() + lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt.after index 268db51f64e9..3d74463a6aaf 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/implicitFunctionCall.kt.after @@ -1,7 +1,7 @@ -// "Add non-null asserted (toLowerCase()!!) call" "true" +// "Add non-null asserted (lowercase()!!) call" "true" // WITH_STDLIB fun String?.foo() { - this!!.toLowerCase() + this!!.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaNullabilityMismatchWithImplicitReceiver.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaNullabilityMismatchWithImplicitReceiver.test index 49a45d85e674..522ce8507eb5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaNullabilityMismatchWithImplicitReceiver.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaNullabilityMismatchWithImplicitReceiver.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Add non-null asserted (this!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? // WITH_STDLIB package p; @@ -40,6 +41,7 @@ public class Foo { // FILE: test.after.kt // "Add non-null asserted (this!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? // WITH_STDLIB package p; diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability1.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability1.test index 439cfe30e670..3eda0c695954 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability1.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability1.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Add non-null asserted (x.foo()!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { @@ -30,6 +31,7 @@ public class Foo { // FILE: test.after.kt // "Add non-null asserted (x.foo()!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability2.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability2.test index 66222fdc1dc4..cdf153490f3f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability2.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullability2.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Add non-null asserted (y!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -38,6 +39,7 @@ public class Foo { // FILE: test.after.kt // "Add non-null asserted (y!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityInvoke.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityInvoke.test index 1769eb748c1d..7f6a8454a578 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityInvoke.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityInvoke.test @@ -1,5 +1,7 @@ // FILE: test.before.kt // "Add non-null asserted (y!!) call" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead +// IGNORE_K1 package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityProperty.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityProperty.test index ba6cbcfab57a..52c896037e21 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityProperty.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityProperty.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Add non-null asserted (x.value!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { @@ -42,6 +43,7 @@ public class Foo { // FILE: test.after.kt // "Add non-null asserted (x.value!!) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityWithThisReceiver.test b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityWithThisReceiver.test index d251b36d5632..91c6e6bc3ea6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityWithThisReceiver.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/javaReceiverNullabilityWithThisReceiver.test @@ -1,6 +1,7 @@ // FILE: test.before.kt // "Add non-null asserted (bar()!!) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -41,6 +42,7 @@ public class Foo { // FILE: test.after.kt // "Add non-null asserted (bar()!!) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt index c7a9733b2142..021e20498c32 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { - a.toLowerCase() + a.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt.after index 2c4fede9028d..d925ddddaa41 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/addExclExclCall/normal2.kt.after @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { - a!!.toLowerCase() + a!!.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/addGenericUpperBound/javaUpperBoundViolated.test b/plugins/kotlin/idea/tests/testData/quickfix/addGenericUpperBound/javaUpperBoundViolated.test index 19321d5e0b6b..9904f3b172a4 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/addGenericUpperBound/javaUpperBoundViolated.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/addGenericUpperBound/javaUpperBoundViolated.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Add 'Any' as upper bound for T" "true" +// ERROR: Type argument is not within its bounds: should be subtype of 'Any' package p; class Derived : Base<T>() {} @@ -30,6 +31,7 @@ public class Base {} // FILE: test.after.kt // "Add 'Any' as upper bound for T" "true" +// ERROR: Type argument is not within its bounds: should be subtype of 'Any' package p; class Derived : Base<T>() {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt index 28f388e807d7..785d9a004d26 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt @@ -1,5 +1,8 @@ // "Fix 'kotlin.browser' package usage" "true" // JS_WITH_DOM_API_COMPAT +// This test broke with the Update to Kotlin 2.1.10 +// We do not update these tests because they are only for K1 and for a legacy inspection +// IGNORE_K1 package test diff --git a/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt.after index 41960511da64..c75e8dd98f76 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/obsoleteKotlinJsPackages/kotlinBrowserFullyQualifiedProperty.kt.after @@ -1,5 +1,8 @@ // "Fix 'kotlin.browser' package usage" "true" // JS_WITH_DOM_API_COMPAT +// This test broke with the Update to Kotlin 2.1.10 +// We do not update these tests because they are only for K1 and for a legacy inspection +// IGNORE_K1 package test diff --git a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNonNullable.test b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNonNullable.test index bee1417016e7..c625d319f54c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNonNullable.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNonNullable.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Change function signature to 'fun foo(x: String): String'" "true" +// ERROR: 'foo' overrides nothing package p; class Bar : Foo() { @@ -50,6 +51,7 @@ public class Foo { // FILE: test.after.kt // "Change function signature to 'fun foo(x: String): String'" "true" +// ERROR: 'foo' overrides nothing package p; class Bar : Foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNullable.test b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNullable.test index d98135524703..6fbae10f06c9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNullable.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeArgumentNullable.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Change function signature to 'fun foo(x: String?): String'" "true" +// ERROR: 'foo' overrides nothing package p; class Bar : Foo() { @@ -50,6 +51,7 @@ public class Foo { // FILE: test.after.kt // "Change function signature to 'fun foo(x: String?): String'" "true" +// ERROR: 'foo' overrides nothing package p; class Bar : Foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeReturnValueNonNullable.test b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeReturnValueNonNullable.test index f72f8cb444c3..fefa5d12d4a8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeReturnValueNonNullable.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/override/wrongNullabilityForJavaOverride/makeReturnValueNonNullable.test @@ -1,5 +1,6 @@ // FILE: test.before.kt -// "Change function signature to 'fun foo(x: String): String'" "true" +// "Change return type to 'String'" "true" +// ERROR: Return type of 'foo' is not a subtype of the return type of the overridden member 'public open fun foo(x: String): String defined in p.Foo' package p; class Bar : Foo() { @@ -49,7 +50,8 @@ public class Foo { } // FILE: test.after.kt -// "Change function signature to 'fun foo(x: String): String'" "true" +// "Change return type to 'String'" "true" +// ERROR: Return type of 'foo' is not a subtype of the return type of the overridden member 'public open fun foo(x: String): String defined in p.Foo' package p; class Bar : Foo() { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt index 59a58aedea24..962f41c5bd57 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt @@ -1,7 +1,7 @@ // "Replace with dot call" "true" // WITH_STDLIB fun foo(a: String) { - a?.toLowerCase() + a?.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithDotCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithDotCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt.after index 105bce526806..070d4076fe18 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithDotCall/functionCall.kt.after @@ -1,7 +1,7 @@ // "Replace with dot call" "true" // WITH_STDLIB fun foo(a: String) { - a.toLowerCase() + a.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithDotCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithDotCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt index 5bd2b2d69009..f2b24d9fd3b1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { a.apply { - toLowerCase() + lowercase() } } // IGNORE_K2 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt.after index 270a0572fef7..a31a487c44a5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/applyWithImplicitParameterFunctionCall.kt.after @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { a.apply { - this?.toLowerCase() + this?.lowercase() } } // IGNORE_K2 diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt index 1bf00eea513a..506724e7a6d6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt @@ -1,7 +1,7 @@ // "Replace with safe (this?.) call" "true" // WITH_STDLIB fun String?.foo() { - toLowerCase() + lowercase() } // IGNORE_K2 // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceImplicitReceiverCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt.after index 1eb71a46a282..2af4ca56d0b8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/extFunction.kt.after @@ -1,7 +1,7 @@ // "Replace with safe (this?.) call" "true" // WITH_STDLIB fun String?.foo() { - this?.toLowerCase() + this?.lowercase() } // IGNORE_K2 // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceImplicitReceiverCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt index b10ee33be9b5..3d6080f73733 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt @@ -1,7 +1,7 @@ // "Replace with safe (?.) call" "true" // WITH_STDLIB fun foo(a: String?) { - a.toLowerCase() + a.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt.after index a0373df4c516..a6a6e72d21c9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/functionCall.kt.after @@ -1,7 +1,7 @@ // "Replace with safe (?.) call" "true" // WITH_STDLIB fun foo(a: String?) { - a?.toLowerCase() + a?.lowercase() } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallFix // FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaNullabilityMismatchWithImplicitReceiver.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaNullabilityMismatchWithImplicitReceiver.test index f32e62eeff55..53dedf81a5ee 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaNullabilityMismatchWithImplicitReceiver.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaNullabilityMismatchWithImplicitReceiver.test @@ -1,6 +1,7 @@ // FILE: test.before.kt // "Replace with safe (this?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -41,6 +42,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (this?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability1.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability1.test index f73398088dcd..eb072892dcd5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability1.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability1.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { @@ -30,6 +31,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability2.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability2.test index a97b6630058d..cab595808cc5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability2.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullability2.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -38,6 +39,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArrayGet.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArrayGet.test index a437b7d8d23c..476df746af25 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArrayGet.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArrayGet.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { @@ -31,6 +32,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArraySet.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArraySet.test index 12648f016573..bc6e504e1939 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArraySet.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityArraySet.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { @@ -32,6 +33,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInfixPlus.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInfixPlus.test index 33bbb986872f..f73ddb41755a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInfixPlus.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInfixPlus.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Operator call corresponds to a dot-qualified call 'y.plus(y)' which is not allowed on a nullable receiver 'y'. package p; fun test(x: Foo) { @@ -32,6 +33,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Operator call corresponds to a dot-qualified call 'y.plus(y)' which is not allowed on a nullable receiver 'y'. package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInvoke.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInvoke.test index 55e282ad4d3f..436b7b1f681f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInvoke.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityInvoke.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Reference has a nullable type 'Foo?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { @@ -32,6 +33,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Reference has a nullable type 'Foo?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityProperty.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityProperty.test index b58beb038e11..d4694829a0f9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityProperty.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityProperty.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { @@ -42,6 +43,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityWithThisReceiver.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityWithThisReceiver.test index b997cb6d9983..bad71bafb952 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityWithThisReceiver.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCall/javaReceiverNullabilityWithThisReceiver.test @@ -1,6 +1,7 @@ // FILE: test.before.kt // "Replace with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -41,6 +42,7 @@ public class Foo { // FILE: test.after.kt // "Replace with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt index d212ff56dba2..6b0800077a47 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { a.apply { - toLowerCase() + lowercase() } } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallForScopeFunctionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt.after index 3ca50c535999..39f2a1e75e3d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/applyWithoutThisMethodCall.kt.after @@ -2,7 +2,7 @@ // WITH_STDLIB fun foo(a: String?) { a?.apply { - toLowerCase() + lowercase() } } // FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ReplaceWithSafeCallForScopeFunctionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityAlso.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityAlso.test index 106096d42e6c..27067f066c41 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityAlso.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityAlso.test @@ -1,6 +1,7 @@ // FILE: test.before.kt // "Replace scope function with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { @@ -35,6 +36,7 @@ public class Foo { // FILE: test.after.kt // "Replace scope function with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityRunExplicitThis.test b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityRunExplicitThis.test index 9d17cbde4afc..ce6b036ab383 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityRunExplicitThis.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/replaceWithSafeCallForScopeFunction/javaReceiverNullabilityRunExplicitThis.test @@ -1,6 +1,7 @@ // FILE: test.before.kt // "Replace scope function with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { @@ -35,6 +36,7 @@ public class Foo { // FILE: test.after.kt // "Replace scope function with safe (?.) call" "true" // WITH_STDLIB +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type Foo? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaNullabilityArgument.test b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaNullabilityArgument.test index 108b4ab730ad..84bf598261cc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaNullabilityArgument.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaNullabilityArgument.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Surround with null check" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} @@ -40,6 +41,7 @@ public class Foo { // FILE: test.after.kt // "Surround with null check" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullability.test b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullability.test index 1da0cece58db..c0ceedc692ac 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullability.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullability.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Surround with null check" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { @@ -38,6 +39,7 @@ public class Foo { // FILE: test.after.kt // "Surround with null check" "true" +// ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type A? package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullabilityInvoke.test b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullabilityInvoke.test index ff35d21066c3..ca1defc3085c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullabilityInvoke.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/surroundWithNullCheck/javaReceiverNullabilityInvoke.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Surround with null check" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { @@ -38,6 +39,7 @@ public class Foo { // FILE: test.after.kt // "Surround with null check" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/extensionMethod.kt b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/extensionMethod.kt index 71705886a3d9..f213565fc59a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/extensionMethod.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/extensionMethod.kt @@ -1,7 +1,6 @@ // "Wrap with '?.let { ... }' call" "false" // WITH_STDLIB -// ACTION: Add non-null asserted (toLowerCase()!!) call -// ACTION: Compiler warning 'DEPRECATION' options +// ACTION: Add non-null asserted (lowercase()!!) call // ACTION: Introduce import alias // ACTION: Introduce local variable // ACTION: Replace with safe (this?.) call @@ -9,5 +8,5 @@ // K2_AFTER_ERROR: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'String?'. fun String?.foo() { - toLowerCase() + lowercase() } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument.test b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument.test index bc20e21b1302..ca3220fbe4d0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} @@ -39,6 +40,7 @@ public class Foo { // FILE: test.after.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument2.test b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument2.test index 2050ea042a3b..c4cc16991164 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument2.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchArgument2.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} @@ -40,6 +41,7 @@ public class Foo { // FILE: test.after.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Type mismatch: inferred type is A? but A was expected package p; fun f(x: A) {} diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchDoNotWrapNull.test b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchDoNotWrapNull.test index adf51f69fb2d..75f03b60136d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchDoNotWrapNull.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaNullabilityMismatchDoNotWrapNull.test @@ -5,6 +5,7 @@ // ACTION: Convert to run // ACTION: Convert to with // ACTION: Do not show hints for current method +// ERROR: Null can not be a value of a non-null type String package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke.test b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke.test index 8d0901d1dab9..4ef4ef3b4840 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { @@ -38,6 +39,7 @@ public class Foo { // FILE: test.after.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { diff --git a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke2.test b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke2.test index 76e3c1543e24..78f0b98d8304 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke2.test +++ b/plugins/kotlin/idea/tests/testData/quickfix/wrapWithSafeLetCall/javaReceiverNullabilityInvoke2.test @@ -1,5 +1,6 @@ // FILE: test.before.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) { @@ -37,6 +38,7 @@ public class Foo { // FILE: test.after.kt // "Wrap with '?.let { ... }' call" "true" +// ERROR: Reference has a nullable type 'A?', use explicit '?.invoke()' to make a function-like call instead package p; fun test(x: Foo) {