From c0c692844ef9ffb6341d3af39476436e081c4e91 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Fri, 10 Mar 2023 11:58:03 +0100 Subject: [PATCH] Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing" This reverts commit 6964121c15f52892aa5c7fd53523690d6a63ad63. --- .../kotlin/cli/js/klib/compilerPipeline.kt | 2 +- .../cli/common/FirSessionConstructionUtils.kt | 33 +++++----- .../FirKotlinToJvmBytecodeCompiler.kt | 3 +- .../jvm/compiler/pipeline/compilerPipeline.kt | 3 +- .../cli/metadata/FirMetadataSerializer.kt | 5 +- .../expectClassActualTypeAlias2.kt | 1 + .../defaultArguments/typeAlias2.kt | 1 + .../k2/annotations/optionalExpectation.kt | 6 +- .../multiplatform/k2/basic/expectProperty.kt | 1 + .../defaultArguments/bothInExpectAndActual.kt | 3 +- .../bothInExpectAndActual2.kt | 3 +- .../k2/defaultArguments/constructor.kt | 1 + .../delegatedExpectedInterface.kt | 1 + .../defaultArguments/dispatchReceiverValue.kt | 6 +- .../extensionReceiverValue.kt | 1 + .../k2/defaultArguments/function.kt | 1 + .../functionFromOtherModule.kt | 5 +- .../inheritedFromCommonClass.kt | 1 + .../inheritedFromExpectedClass.kt | 1 + .../inheritedFromExpectedInterface.kt | 1 + .../inheritedFromExpectedMethod.kt | 1 + .../inheritedInExpectedDeclarations.kt | 1 + .../inheritedViaAnotherInterfaceIndirectly.kt | 1 + .../inlineFunctionWithDefaultLambda.kt | 1 + .../k2/defaultArguments/kt23239.kt | 1 + .../k2/defaultArguments/kt23739.kt | 1 + .../parametersInArgumentValues.kt | 1 + .../k2/defaultArguments/suspend.kt | 3 +- .../k2/defaultArguments/typeAlias.kt | 1 + .../k2/defaultArguments/withTypeParameter.kt | 6 +- .../checkers/KotlinMultiFileTestWithJava.kt | 4 +- .../AbstractKlibBinaryCompatibilityTest.kt | 4 +- .../jetbrains/kotlin/test/KotlinBaseTest.kt | 4 +- .../org/jetbrains/kotlin/test/TestFiles.java | 65 ++++++++----------- .../AbstractJvmRuntimeDescriptorLoaderTest.kt | 2 - .../jetbrains/kotlin/backend/konan/Fir2Ir.kt | 3 - .../kotlin/backend/konan/FirFrontend.kt | 2 +- .../AbstractNativeCInteropBaseTest.kt | 2 +- .../AbstractNativeCInteropKT39120Test.kt | 2 +- .../blackboxtest/AbstractNativeKlibABITest.kt | 4 +- ...stractNativeKlibBinaryCompatibilityTest.kt | 4 +- .../AbstractNativeKlibContentsTest.kt | 2 +- .../blackboxtest/NativeSimpleTestUtils.kt | 3 +- .../konan/blackboxtest/support/TestCase.kt | 21 +----- .../blackboxtest/support/TestDirectives.kt | 9 +-- .../support/compilation/TestCompilation.kt | 15 ----- .../compilation/TestCompilationDependency.kt | 1 - .../compilation/TestCompilationFactory.kt | 21 +----- .../support/group/ExtTestCaseGroupProvider.kt | 23 ++----- .../group/PredefinedTestCaseGroupProvider.kt | 3 +- .../plugin/impl/ScriptJvmCompilerImpls.kt | 3 +- 51 files changed, 106 insertions(+), 187 deletions(-) diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt index 937920ce829..d35b0a68b21 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt @@ -81,7 +81,7 @@ fun compileModuleToAnalyzedFir( val resolvedLibraries = moduleStructure.fullResolvedLibraries val sessionsWithSources = prepareJsSessions( - ktFiles, moduleStructure.compilerConfiguration, escapedMainModuleName, + ktFiles, moduleStructure.compilerConfiguration, escapedMainModuleName.asString(), resolvedLibraries, dependencyList, extensionRegistrars, isCommonSourceForPsi, fileBelongsToModuleForPsi ) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/FirSessionConstructionUtils.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/FirSessionConstructionUtils.kt index 0c5e3307383..33b6f2a14a8 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/FirSessionConstructionUtils.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/FirSessionConstructionUtils.kt @@ -55,7 +55,7 @@ fun prepareJvmSessions( files: List, configuration: CompilerConfiguration, projectEnvironment: AbstractProjectEnvironment, - rootModuleName: Name, + rootModuleName: String, extensionRegistrars: List, librariesScope: AbstractProjectFileSearchScope, libraryList: DependencyListForCliModule, @@ -70,7 +70,7 @@ fun prepareJvmSessions( JvmPlatformAnalyzerServices, libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirJvmSessionFactory.createLibrarySession( - rootModuleName, + Name.identifier(rootModuleName), sessionProvider, libraryList.moduleDataProvider, projectEnvironment, @@ -109,7 +109,7 @@ fun prepareJvmSessions( fun prepareJsSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: Name, + rootModuleName: String, resolvedLibraries: List, libraryList: DependencyListForCliModule, extensionRegistrars: List, @@ -121,7 +121,7 @@ fun prepareJsSessions( libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirJsSessionFactory.createLibrarySession( - rootModuleName, + Name.identifier(rootModuleName), resolvedLibraries, sessionProvider, libraryList.moduleDataProvider, @@ -152,7 +152,7 @@ fun prepareJsSessions( fun prepareNativeSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: Name, + rootModuleName: String, resolvedLibraries: List, libraryList: DependencyListForCliModule, extensionRegistrars: List, @@ -163,7 +163,7 @@ fun prepareNativeSessions( files, configuration, rootModuleName, NativePlatforms.unspecifiedNativePlatform, NativePlatformAnalyzerServices, libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirNativeSessionFactory.createLibrarySession( - rootModuleName, + Name.identifier(rootModuleName), resolvedLibraries, sessionProvider, libraryList.moduleDataProvider, @@ -193,7 +193,7 @@ fun prepareCommonSessions( files: List, configuration: CompilerConfiguration, projectEnvironment: AbstractProjectEnvironment, - rootModuleName: Name, + rootModuleName: String, extensionRegistrars: List, librariesScope: AbstractProjectFileSearchScope, libraryList: DependencyListForCliModule, @@ -206,7 +206,7 @@ fun prepareCommonSessions( files, configuration, rootModuleName, CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices, libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirCommonSessionFactory.createLibrarySession( - rootModuleName, + Name.identifier(rootModuleName), sessionProvider, libraryList.moduleDataProvider, projectEnvironment, @@ -240,7 +240,7 @@ private typealias FirSessionProducer = (List, FirModuleData, FirProjectSes private inline fun prepareSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: Name, + rootModuleName: String, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, libraryList: DependencyListForCliModule, @@ -277,7 +277,7 @@ private inline fun prepareSessions( ) else -> createSessionsForHmppProject( - files, rootModuleName, hmppModuleStructure, libraryList, targetPlatform, analyzerServices, + files, hmppModuleStructure, libraryList, targetPlatform, analyzerServices, sessionProvider, sessionConfigurator, fileBelongsToModule, createSourceSession ) } @@ -285,7 +285,7 @@ private inline fun prepareSessions( private inline fun createSessionForNonMppProject( files: List, - rootModuleName: Name, + rootModuleName: String, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, @@ -294,7 +294,7 @@ private inline fun createSessionForNonMppProject( createFirSession: FirSessionProducer, ): SessionWithSources { val platformModuleData = FirModuleDataImpl( - rootModuleName, + Name.identifier(rootModuleName), libraryList.regularDependencies, dependsOnDependencies = emptyList(), libraryList.friendsDependencies, @@ -308,7 +308,7 @@ private inline fun createSessionForNonMppProject( private inline fun createSessionsForLegacyMppProject( files: List, - rootModuleName: Name, + rootModuleName: String, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, @@ -318,7 +318,7 @@ private inline fun createSessionsForLegacyMppProject( createFirSession: FirSessionProducer, ): List> { val commonModuleData = FirModuleDataImpl( - Name.identifier("${rootModuleName.asString()}-common"), + Name.identifier("${rootModuleName}-common"), libraryList.regularDependencies, listOf(), libraryList.friendsDependencies, @@ -327,7 +327,7 @@ private inline fun createSessionsForLegacyMppProject( ) val platformModuleData = FirModuleDataImpl( - rootModuleName, + Name.identifier(rootModuleName), libraryList.regularDependencies, listOf(commonModuleData), libraryList.friendsDependencies, @@ -352,7 +352,6 @@ private inline fun createSessionsForLegacyMppProject( private inline fun createSessionsForHmppProject( files: List, - rootModuleName: Name, hmppModuleStructure: HmppCliModuleStructure, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, @@ -369,7 +368,7 @@ private inline fun createSessionsForHmppProject( ?.map { moduleDataForHmppModule.getValue(it) } .orEmpty() val moduleData = FirModuleDataImpl( - rootModuleName, + Name.identifier(module.name), libraryList.regularDependencies, dependsOnDependencies = dependencies, libraryList.friendsDependencies, diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt index 0f41d820107..8a27e53660b 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt @@ -44,7 +44,6 @@ import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompil import org.jetbrains.kotlin.modules.Module import org.jetbrains.kotlin.modules.TargetId import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.multiplatform.hmppModuleName @@ -201,7 +200,7 @@ object FirKotlinToJvmBytecodeCompiler { val rootModuleName = module.getModuleName() val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, module.getFriendPaths()) val sessionsWithSources = prepareJvmSessions( - ktFiles, moduleConfiguration, projectEnvironment, Name.identifier(rootModuleName), + ktFiles, moduleConfiguration, projectEnvironment, rootModuleName, extensionRegistrars, librariesScope, libraryList, isCommonSource = { it.isCommonSource == true }, fileBelongsToModule = { file, moduleName -> file.hmppModuleName == moduleName }, diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt index 5cf52ec5074..9032cb8c70d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/compilerPipeline.kt @@ -65,7 +65,6 @@ import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackagePartProvid import org.jetbrains.kotlin.modules.Module import org.jetbrains.kotlin.modules.TargetId import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.CommonPlatforms import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus @@ -327,7 +326,7 @@ fun compileModuleToAnalyzedFir( // TODO: handle friends paths val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, friendPaths = emptyList()) val sessionWithSources = prepareJvmSessions( - allSources, moduleConfiguration, projectEnvironment, Name.identifier(rootModuleName), + allSources, moduleConfiguration, projectEnvironment, rootModuleName, extensionRegistrars, librariesScope, libraryList, isCommonSource = input.groupedSources.isCommonSourceForLt, fileBelongsToModule = input.groupedSources.fileBelongsToModuleForLt, diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt index 9361e84ab93..0920d3b19fb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt @@ -57,11 +57,12 @@ internal class FirMetadataSerializer( val configuration = environment.configuration val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) - val rootModuleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>") + val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>") val isLightTree = configuration.getBoolean(CommonConfigurationKeys.USE_LIGHT_TREE) + val rootModuleName = moduleName.asString() val binaryModuleData = BinaryModuleData.initialize( - rootModuleName, + Name.identifier(rootModuleName), CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices ) diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt index ba3414b4412..9403585698f 100644 --- a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND: NATIVE // !LANGUAGE: +MultiPlatformProjects // IGNORE_BACKEND_K1: ANY // IGNORE_BACKEND_MULTI_MODULE: ANY diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt index 1b4bc38228f..419afed9848 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +MultiPlatformProjects // WITH_STDLIB // IGNORE_BACKEND_K1: ANY +// IGNORE_BACKEND_K2: NATIVE // MODULE: common // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt b/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt index 263d657ec53..5fb83bbbc4a 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt @@ -1,10 +1,8 @@ // !LANGUAGE: +MultiPlatformProjects // !OPT_IN: kotlin.ExperimentalMultiplatform -// IGNORE_BACKEND: WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// IGNORE_BACKEND: NATIVE, WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // IGNORE_BACKEND_K2: JS_IR -// KT-57181 -// IGNORE_BACKEND_K2: NATIVE // WITH_STDLIB // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt b/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt index dbb7bb3fd4b..9e48f4c5527 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt index f667ab6f5f7..cee100884b1 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// IGNORE_BACKEND: NATIVE +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt index 30b42191e12..9b48968c477 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// IGNORE_BACKEND: NATIVE +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common // FILE: common.kt diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt index 67c0738756e..0765858f9ed 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt index 19a1cdbdabb..9544bf94d75 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt index 31670996d58..d7b3aacad72 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt @@ -1,7 +1,5 @@ -// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, NATIVE -// KT-57181 -// IGNORE_BACKEND_K2: NATIVE +// IGNORE_BACKEND: JS_IR, JS_IR_ES6, NATIVE, WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS // WASM_MUTE_REASON: EXPECT_DEFAULT_PARAMETERS // !LANGUAGE: +MultiPlatformProjects // ISSUE: KT-41901 diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt index f1c3ee477e1..9ba6bcca385 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt index 4c6b08fba91..0ced3bd3244 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt index a403c3b6ddf..36e3e1a4cc0 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt @@ -1,7 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE -// KT-57181 -// IGNORE_BACKEND_K2: NATIVE +// IGNORE_BACKEND: NATIVE +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt index 3b10d633d49..39ec2a0de12 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt index 8f9185a0989..12057d541c7 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt index 0e5b30d9885..c87558690d5 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt index 64593ef9cc0..05f2e18dbc4 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt index 589bfa8dd69..54b8b21b4c9 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt index b5102ecdd85..75ed917461a 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt index e3dca386689..290b0fc96d9 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt index 1737ce86e9b..ccfbfcf190e 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt index f5da314ced5..ec65b978ce6 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt index 3fd684a1e24..7b05294063d 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // MODULE: common diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt index b145dd8cf0a..5a163f94fc3 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// IGNORE_BACKEND: NATIVE +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB // WITH_COROUTINES diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt index 55ea09cb98b..959b162cf52 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects +// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // WITH_STDLIB diff --git a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt index c1c293471a6..733251799e6 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt @@ -1,9 +1,7 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// IGNORE_BACKEND: NATIVE, WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 // IGNORE_BACKEND_K2: JS_IR -// KT-57181 -// IGNORE_BACKEND_K2: NATIVE // WITH_STDLIB // MODULE: common diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt index 06a3b1f764d..5797891695f 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt @@ -4,7 +4,6 @@ */ package org.jetbrains.kotlin.checkers -import org.jetbrains.kotlin.ObsoleteTestInfrastructure import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment @@ -119,7 +118,6 @@ abstract class KotlinMultiFileTestWithJava, friends: List, dependsOn: List): M? { + override fun createModule(name: String, dependencies: List, friends: List, abiVersions: List): M? { val module = createTestModule(name, dependencies, friends) val oldValue = modules.put(name, ModuleAndDependencies(module, dependencies, friends)) assert(oldValue == null) { "Module $name declared more than once" } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/compatibility/binary/AbstractKlibBinaryCompatibilityTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/compatibility/binary/AbstractKlibBinaryCompatibilityTest.kt index 3c01a9bc064..8ee0aeafdd7 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/compatibility/binary/AbstractKlibBinaryCompatibilityTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/compatibility/binary/AbstractKlibBinaryCompatibilityTest.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.compatibility.binary -import org.jetbrains.kotlin.ObsoleteTestInfrastructure import org.jetbrains.kotlin.test.* import org.jetbrains.kotlin.test.util.KtTestUtil import org.jetbrains.kotlin.utils.DFS @@ -72,7 +71,6 @@ abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment() const val TEST_FUNCTION = "box" const val DEFAULT_MODULE = "main" - @OptIn(ObsoleteTestInfrastructure::class) fun doTest( filePath: String, expectedResult: String, @@ -91,7 +89,7 @@ abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment() TestFile(module, fileName, text, directives) } ?: error("Expected a module for $fileName in $filePath") - override fun createModule(name: String, dependencies: List, friends: List, dependsOn: List) = + override fun createModule(name: String, dependencies: List, friends: List, abiVersions: List) = TestModule(name, dependencies, friends) }, diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index e5770265237..e715711190a 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -108,13 +108,11 @@ abstract class KotlinBaseTest : KtUsefulTestCase() open class TestModule( @JvmField val name: String, @JvmField val dependenciesSymbols: List, - @JvmField val friendsSymbols: List, - @JvmField val dependsOnSymbols: List = listOf(), // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter + @JvmField val friendsSymbols: List ) : Comparable { val dependencies: MutableList = arrayListOf() val friends: MutableList = arrayListOf() - val dependsOn: MutableList = arrayListOf() override fun compareTo(other: TestModule): Int = name.compareTo(other.name) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java index 80cd3e18a47..b2b84f1d06e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java @@ -6,10 +6,8 @@ package org.jetbrains.kotlin.test; import com.google.common.collect.Lists; -import kotlin.text.StringsKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.ObsoleteTestInfrastructure; import org.jetbrains.kotlin.TestHelperGeneratorKt; import java.util.*; @@ -20,12 +18,11 @@ import java.util.stream.Collectors; import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isDirectiveDefined; import static org.jetbrains.kotlin.test.KotlinTestUtils.parseDirectives; -@ObsoleteTestInfrastructure // THIS TEST PARSER IS OUTDATED/DEPRECATED. PLEASE USE ModuleStructureExtractor INSTEAD public class TestFiles { /** * Syntax: * - * // MODULE: name(dependency1, dependency2, ...)(friend1, friend2, ...)(dependsOn1, dependsOn2, ...) + * // MODULE: name(dependency1, dependency2, ...) * * // FILE: name * @@ -33,11 +30,7 @@ public class TestFiles { */ private static final String MODULE_DELIMITER = ",\\s*"; - private static final Pattern MODULE_PREFIX_PATTERN = Pattern.compile("//\\s*MODULE:.*\n"); - private static final Pattern MODULE_PATTERN = Pattern.compile("//\\s*MODULE:\\s*([^()\\n]+)" + // name - "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // dependencies - "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*" + // friends - "(?:\\(([^()]*(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\n"); // dependsOn + private static final Pattern MODULE_PATTERN = Pattern.compile("//\\s*MODULE:\\s*([^()\\n]+)(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*(?:\\((\\d+(?:" + MODULE_DELIMITER + "\\d+)*)\\))?\n"); private static final Pattern FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)\n"); private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n"); @@ -60,15 +53,11 @@ public class TestFiles { List testFiles = Lists.newArrayList(); Matcher fileMatcher = FILE_PATTERN.matcher(expectedText); Matcher moduleMatcher = MODULE_PATTERN.matcher(expectedText); - Matcher modulePrefixMatcher = MODULE_PREFIX_PATTERN.matcher(expectedText); boolean hasModules = false; String commonPrefixOrWholeFile; boolean fileFound = fileMatcher.find(); boolean moduleFound = moduleMatcher.find(); - boolean modulePrefixFound = modulePrefixMatcher.find(); - assert moduleFound == modulePrefixFound : "First MODULE directive doesn't match to the expected pattern in:\n" + expectedText; - if (!fileFound && !moduleFound) { assert testFileName != null : "testFileName should not be null if no FILE directive defined"; // One file @@ -96,20 +85,17 @@ public class TestFiles { String moduleName = moduleMatcher.group(1); String moduleDependencies = moduleMatcher.group(2); String moduleFriends = moduleMatcher.group(3); - String moduleDependsOn = moduleMatcher.group(4); + String abiVersions = moduleMatcher.group(4); if (moduleName != null) { moduleName = moduleName.trim(); hasModules = true; - module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseModuleList(moduleDependsOn)); + module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseAbiVersionsList(abiVersions)); M oldValue = modules.put(moduleName, module); assert oldValue == null : "Module with name " + moduleName + " already present in file"; } } boolean nextModuleExists = moduleMatcher.find(); - boolean nextModulePrefixExists = modulePrefixMatcher.find(); - assert nextModuleExists == nextModulePrefixExists : "Continuation MODULE directive doesn't match to the expected pattern in:\n" + expectedText; - moduleFound = nextModuleExists; while (true) { String fileName = fileMatcher.group(1); @@ -170,26 +156,19 @@ public class TestFiles { for (M module : modules.values()) { if (module != null) { - module.getDependencies().addAll(module.dependenciesSymbols.stream().map(name -> { - M dep = modules.get(name); - assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText; - return dep; - }).collect(Collectors.toList())); + module.getDependencies().addAll(module.dependenciesSymbols.stream() + .map(modules::get) + .filter(Objects::nonNull) + .collect(Collectors.toList())); - module.getFriends().addAll(module.friendsSymbols.stream().map(name -> { - M dep = modules.get(name); - assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText; - return dep; - }).collect(Collectors.toList())); - - module.getDependsOn().addAll(module.dependsOnSymbols.stream().map(name -> { - M dep = modules.get(name); - assert dep != null : "Dependency not found: " + name + " for module " + module.name + " in:\n" + expectedText; - return dep; - }).collect(Collectors.toList())); + module.getFriends().addAll(module.friendsSymbols.stream() + .map(modules::get) + .filter(Objects::nonNull) + .collect(Collectors.toList())); } } + return testFiles; } @@ -214,13 +193,23 @@ public class TestFiles { } private static List parseModuleList(@Nullable String dependencies) { - if (dependencies == null || StringsKt.isBlank(dependencies)) return Collections.emptyList(); - return StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0); + if (dependencies == null) return Collections.emptyList(); + return kotlin.text.StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0); + } + + private static List parseAbiVersionsList(@Nullable String versions) { + if (versions == null) return Collections.emptyList(); + List splitted = kotlin.text.StringsKt.split(versions, Pattern.compile(MODULE_DELIMITER), 0); + List result = new ArrayList<>(splitted.size()); + for (String s : splitted) { + result.add(Integer.parseInt(s)); + } + return result; } public interface TestFileFactory { F createFile(@Nullable M module, @NotNull String fileName, @NotNull String text, @NotNull Directives directives); - M createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List dependsOn); + M createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List abiVersions); } public static abstract class TestFileFactoryNoModules implements TestFileFactory { @@ -238,7 +227,7 @@ public class TestFiles { public abstract F create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives); @Override - public KotlinBaseTest.TestModule createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List dependsOn) { + public KotlinBaseTest.TestModule createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List abiVersions) { return null; } } diff --git a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt index e68a980f063..5e0a4c400c6 100644 --- a/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt +++ b/core/descriptors.runtime/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.jvm.runtime import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.util.io.FileUtil -import org.jetbrains.kotlin.ObsoleteTestInfrastructure import org.jetbrains.kotlin.checkers.KotlinMultiFileTestWithJava import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.codegen.GenerationUtils @@ -112,7 +111,6 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() { containingDeclaration is JavaClassDescriptor && containingDeclaration.kind == ClassKind.ANNOTATION_CLASS - @OptIn(ObsoleteTestInfrastructure::class) private fun compileFile(file: File, text: String, jdkKind: TestJdkKind) { val fileName = file.name when { diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Fir2Ir.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Fir2Ir.kt index 18cdb0cbaa2..766087c3815 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Fir2Ir.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Fir2Ir.kt @@ -71,9 +71,6 @@ internal fun PhaseContext.fir2Ir( ).also { (it.irModuleFragment.descriptor as? FirModuleDescriptor)?.let { it.allDependencyModules = librariesDescriptors } } - assert(fir2irResult.irModuleFragment.name.isSpecial) { - "`${fir2irResult.irModuleFragment.name}` must be Name.special, since it's required by KlibMetadataModuleDescriptorFactoryImpl.createDescriptorOptionalBuiltIns()" - } val symbols = createKonanSymbols(fir2irResult) // TODO KT-55580 Invoke CopyDefaultValuesToActualPhase, same as PsiToir phase does. diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/FirFrontend.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/FirFrontend.kt index 87ca1237a4d..47e4f06b107 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/FirFrontend.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/FirFrontend.kt @@ -42,7 +42,7 @@ internal fun PhaseContext.firFrontend(input: KotlinCoreEnvironment): FirOutput { val resolvedLibraries: List = config.resolvedLibraries.getFullResolvedList() val sessionsWithSources = prepareNativeSessions( - ktFiles, configuration, mainModuleName, resolvedLibraries, dependencyList, + ktFiles, configuration, mainModuleName.asString(), resolvedLibraries, dependencyList, extensionRegistrars, isCommonSourceForPsi, fileBelongsToModuleForPsi ) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropBaseTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropBaseTest.kt index 836e0160fdf..ae09cf8bcae 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropBaseTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropBaseTest.kt @@ -32,7 +32,7 @@ abstract class AbstractNativeCInteropBaseTest : AbstractNativeSimpleTest() { internal fun generateCInteropTestCaseWithSingleDef(defFile: File, extraArgs: List): TestCase { val moduleName: String = defFile.name - val module = TestModule.Exclusive(moduleName, emptySet(), emptySet(), emptySet()) + val module = TestModule.Exclusive(moduleName, emptySet(), emptySet()) module.files += TestFile.createCommitted(defFile, module) return TestCase( diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropKT39120Test.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropKT39120Test.kt index 537d44f73a9..d757e1a0b50 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropKT39120Test.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeCInteropKT39120Test.kt @@ -56,7 +56,7 @@ abstract class AbstractNativeCInteropKT39120Test : AbstractNativeCInteropBaseTes val ktFile = testPathFull.resolve(DEFAULT_FILE_NAME) if (ktFile.exists()) { // Just compile "main.kt" with klib1 and klib2, without running resulting executable - val module = TestModule.Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet(), emptySet()).apply { + val module = TestModule.Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet()).apply { files += TestFile.createCommitted(ktFile, this) } val compilationResult = compileToExecutable( diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt index 248022b9c43..7c3f5477ff3 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibABITest.kt @@ -107,7 +107,6 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() { settings = testRunSettings, freeCompilerArgs = COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE, options = StaticCacheCompilation.Options.Regular, - pipelineType = testRunSettings.get(), dependencies = createLibraryCacheDependencies(moduleDependencies) + klibArtifact.toDependency(), expectedArtifact = klibArtifact.toStaticCacheArtifact() ) @@ -119,8 +118,7 @@ abstract class AbstractNativeKlibABITest : AbstractNativeSimpleTest() { name = moduleName, directDependencySymbols = emptySet(), /* Don't need to pass any dependency symbols here. Dependencies are already handled by the AbstractKlibABITestCase class. */ - directFriendSymbols = emptySet(), - directDependsOnSymbols = emptySet(), + directFriendSymbols = emptySet() ) private fun createTestCase(module: TestModule.Exclusive, compilerArgs: TestCompilerArgs) = TestCase( diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibBinaryCompatibilityTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibBinaryCompatibilityTest.kt index db990a7b6aa..62b99c76bfe 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibBinaryCompatibilityTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibBinaryCompatibilityTest.kt @@ -127,7 +127,6 @@ abstract class AbstractNativeKlibBinaryCompatibilityTest : AbstractNativeSimpleT settings = testRunSettings, freeCompilerArgs = COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE, options = StaticCacheCompilation.Options.Regular, - pipelineType = testRunSettings.get(), dependencies = moduleDependencies.map { it.klibFile.toStaticCacheArtifact().toDependency() } + klib.toKlib().toDependency(), @@ -143,8 +142,7 @@ abstract class AbstractNativeKlibBinaryCompatibilityTest : AbstractNativeSimpleT val module: TestModule.Exclusive = TestModule.Exclusive( name = name, directDependencySymbols = emptySet(), - directFriendSymbols = emptySet(), - directDependsOnSymbols = emptySet(), + directFriendSymbols = emptySet() ) val localBuildDir: File = diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibContentsTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibContentsTest.kt index 72b84707296..830fe095a3a 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibContentsTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/AbstractNativeKlibContentsTest.kt @@ -39,7 +39,7 @@ abstract class AbstractNativeKlibContentsTest : AbstractNativeSimpleTest() { private fun generateTestCaseWithSingleSource(source: File, extraArgs: List): TestCase { val moduleName: String = source.name - val module = TestModule.Exclusive(moduleName, emptySet(), emptySet(), emptySet()) + val module = TestModule.Exclusive(moduleName, emptySet(), emptySet()) module.files += TestFile.createCommitted(source, module) return TestCase( diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/NativeSimpleTestUtils.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/NativeSimpleTestUtils.kt index 60ba0e80e8c..14118551804 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/NativeSimpleTestUtils.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/NativeSimpleTestUtils.kt @@ -80,7 +80,6 @@ internal fun AbstractNativeSimpleTest.compileToStaticCache( settings = testRunSettings, freeCompilerArgs = TestCompilerArgs.EMPTY, StaticCacheCompilation.Options.Regular, - pipelineType = testRunSettings.get(), dependencies = listOf(klib.asLibraryDependency()), expectedArtifact = TestCompilationArtifact.KLIBStaticCache(cacheDir, klib) ) @@ -92,7 +91,7 @@ internal fun AbstractNativeSimpleTest.generateTestCaseWithSingleModule( freeCompilerArgs: TestCompilerArgs = TestCompilerArgs.EMPTY ): TestCase { val moduleName: String = moduleDir?.name ?: LAUNCHER_MODULE_NAME - val module = TestModule.Exclusive(moduleName, emptySet(), emptySet(), emptySet()) + val module = TestModule.Exclusive(moduleName, emptySet(), emptySet()) moduleDir?.walkTopDown() ?.filter { it.isFile && it.extension == "kt" } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestCase.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestCase.kt index a2abe1cd6e4..2e55b728141 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestCase.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestCase.kt @@ -9,7 +9,6 @@ package org.jetbrains.kotlin.konan.blackboxtest.support import org.jetbrains.kotlin.konan.blackboxtest.support.TestCase.WithTestRunnerExtras import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allDependencies -import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allDependsOn import org.jetbrains.kotlin.konan.blackboxtest.support.runner.TestRunChecks import org.jetbrains.kotlin.konan.blackboxtest.support.util.* import org.jetbrains.kotlin.storage.LockBasedStorageManager @@ -86,19 +85,16 @@ internal sealed class TestModule { data class Exclusive( override val name: String, val directDependencySymbols: Set, - val directFriendSymbols: Set, - val directDependsOnSymbols: Set, // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter + val directFriendSymbols: Set ) : TestModule() { override val files: FailOnDuplicatesSet> = FailOnDuplicatesSet() lateinit var directDependencies: Set lateinit var directFriends: Set - lateinit var directDependsOn: Set // N.B. The following two properties throw an exception on attempt to resolve cyclic dependencies. val allDependencies: Set by SM.lazyNeighbors({ directDependencies }, { it.allDependencies }) val allFriends: Set by SM.lazyNeighbors({ directFriends }, { it.allFriends }) - val allDependsOn: Set by SM.lazyNeighbors({ directDependsOn }, { it.allDependsOn }) lateinit var testCase: TestCase @@ -107,9 +103,7 @@ internal sealed class TestModule { } fun haveSameSymbols(other: Exclusive) = - other.directDependencySymbols == directDependencySymbols && - other.directFriendSymbols == directFriendSymbols && - other.directDependsOnSymbols == directDependsOnSymbols + other.directDependencySymbols == directDependencySymbols && other.directFriendSymbols == directFriendSymbols } data class Shared(override val name: String) : TestModule() { @@ -128,7 +122,7 @@ internal sealed class TestModule { final override fun toString() = "${javaClass.canonicalName}[name=$name]" companion object { - fun newDefaultModule() = Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet(), emptySet()) + fun newDefaultModule() = Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet()) val TestModule.allDependencies: Set get() = when (this) { @@ -142,12 +136,6 @@ internal sealed class TestModule { is Shared, is Given -> emptySet() } - val TestModule.allDependsOn: Set - get() = when (this) { - is Exclusive -> allDependsOn - is Shared, is Given -> emptySet() - } - private val SM = LockBasedStorageManager(TestModule::class.java.name) } } @@ -210,13 +198,11 @@ internal class TestCase( modules.forEach { module -> allModules += module allModules += module.allDependencies - allModules += module.allDependsOn } val rootModules = allModules.toHashSet() allModules.forEach { module -> rootModules -= module.allDependencies - rootModules -= module.allDependsOn } assertTrue(rootModules.isNotEmpty()) { "$id: No root modules in test case." } @@ -271,7 +257,6 @@ internal class TestCase( } module.directFriends = module.directFriendSymbols.mapToSet(::findModule) - module.directDependsOn = module.directDependsOnSymbols.mapToSet(::findModule) } } } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestDirectives.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestDirectives.kt index 60e092c77cb..21cbdb82faf 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestDirectives.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/TestDirectives.kt @@ -242,14 +242,13 @@ internal fun parseModule(parsedDirective: RegisteredDirectivesParser.ParsedDirec val name = match.groupValues[1] val directDependencySymbols = match.groupValues[3].split(',').filter(String::isNotEmpty).toSet() val directFriendSymbols = match.groupValues[5].split(',').filter(String::isNotEmpty).toSet() - val directDependsOnSymbols = match.groupValues[7].split(',').filter(String::isNotEmpty).toSet() val friendsThatAreNotDependencies = directFriendSymbols - directDependencySymbols assertTrue(friendsThatAreNotDependencies.isEmpty()) { "$location: Found friends that are not dependencies: $friendsThatAreNotDependencies" } - TestModule.Exclusive(name, directDependencySymbols, directFriendSymbols, directDependsOnSymbols) + TestModule.Exclusive(name, directDependencySymbols, directFriendSymbols) } return module ?: fail { @@ -260,11 +259,7 @@ internal fun parseModule(parsedDirective: RegisteredDirectivesParser.ParsedDirec } } -private val TEST_MODULE_REGEX = Regex("^([a-zA-Z0-9_]+)(" + // name - "\\(([a-zA-Z0-9_,]*)\\)" + // dependencies - "(\\(([a-zA-Z0-9_,]*)\\))?" + // friends - "(\\(([a-zA-Z0-9_,]*)\\))?" + // dependsOn - ")?$") +private val TEST_MODULE_REGEX = Regex("^([a-zA-Z0-9_]+)(\\(([a-zA-Z0-9_,]*)\\)(\\(([a-zA-Z0-9_,]*)\\))?)?$") internal fun parseFileName(parsedDirective: RegisteredDirectivesParser.ParsedDirective, location: Location): String { val fileName = parsedDirective.values.singleOrNull()?.toString() diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt index c206a7153e3..61e4e3e1225 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilation.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.konan.blackboxtest.support.compilation import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.konan.blackboxtest.support.* import org.jetbrains.kotlin.konan.blackboxtest.support.TestCase.* -import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allDependsOn import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.ExecutableCompilation.Companion.applyTestRunnerSpecificArgs import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.ExecutableCompilation.Companion.assertTestDumpFileNotEmptyIfExists import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact.* @@ -155,7 +154,6 @@ internal abstract class SourceBasedCompilation( gcType.compilerFlag?.let { compilerFlag -> add(compilerFlag) } gcScheduler.compilerFlag?.let { compilerFlag -> add(compilerFlag) } pipelineType.compilerFlags.forEach { compilerFlag -> add(compilerFlag) } - applyK2MPPArgs(this) } override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { @@ -165,17 +163,6 @@ internal abstract class SourceBasedCompilation( } add(dependencies.includedLibraries) { include -> "-Xinclude=${include.path}" } } - - private fun applyK2MPPArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { - if (pipelineType == PipelineType.K2 && freeCompilerArgs.compilerArgs.any { it == "-XXLanguage:+MultiPlatformProjects" }) { - sourceModules.mapToSet { "-Xfragments=${it.name}" } - .sorted().forEach { add(it) } - sourceModules.flatMapToSet { module -> module.allDependsOn.map { "-Xfragment-refines=${module.name}:${it.name}" } } - .sorted().forEach { add(it) } - sourceModules.flatMapToSet { module -> module.files.map { "-Xfragment-sources=${module.name}:${it.location.path}" } } - .sorted().forEach { add(it) } - } - } } internal class LibraryCompilation( @@ -351,7 +338,6 @@ internal class StaticCacheCompilation( settings: Settings, freeCompilerArgs: TestCompilerArgs, private val options: Options, - private val pipelineType: PipelineType, dependencies: Iterable>, expectedArtifact: KLIBStaticCache ) : BasicCompilation( @@ -381,7 +367,6 @@ internal class StaticCacheCompilation( override fun applySpecificArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { add("-produce", "static_cache") - pipelineType.compilerFlags.forEach { compilerFlag -> add(compilerFlag) } when (options) { is Options.Regular -> Unit /* Nothing to do. */ diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationDependency.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationDependency.kt index 11192cee110..d736befc47f 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationDependency.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationDependency.kt @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilati * [Library] - the [TestCompilation]s (modules) that should yield KLIBs to be consumed as dependency libraries in the current compilation. * [FriendLibrary] - similarly but friend modules (-friend-modules). * [IncludedLibrary] - similarly but included modules (-Xinclude). - * Note: there cannot be DependsOnLibrary type, since `dependsOn` dependency works only within a KLIB, not between KLIBs. */ internal sealed class TestCompilationDependencyType(private val artifactClass: Class) { object Library : TestCompilationDependencyType(KLIB::class.java) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt index 3f537936eee..09ae5a44e77 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/compilation/TestCompilationFactory.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.TestCase.* import org.jetbrains.kotlin.konan.blackboxtest.support.TestCompilerArgs import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allDependencies -import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allDependsOn import org.jetbrains.kotlin.konan.blackboxtest.support.TestModule.Companion.allFriends import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationArtifact.* import org.jetbrains.kotlin.konan.blackboxtest.support.compilation.TestCompilationDependencyType.* @@ -159,7 +158,7 @@ internal class TestCompilationFactory { LibraryCompilation( settings = settings, freeCompilerArgs = freeCompilerArgs, - sourceModules = sourceModules.flatMapToSet { sortDependsOnTopologically(it) }, + sourceModules = sourceModules, dependencies = dependencies.forKlib(), expectedArtifact = klibArtifact ) @@ -170,7 +169,6 @@ internal class TestCompilationFactory { settings = settings, freeCompilerArgs = freeCompilerArgs, options = staticCacheOptions, - pipelineType = settings.get(), dependencies = dependencies.forStaticCache(klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library)), expectedArtifact = staticCacheArtifact ) @@ -205,23 +203,6 @@ internal class TestCompilationFactory { return CompilationDependencies(klibDependencies, staticCacheDependencies) } - // mimics FirFrontendFacade.sortDependsOnTopologically(org.jetbrains.kotlin.test.model.TestModule) - private fun sortDependsOnTopologically(module: TestModule): List { - val sortedModules = mutableListOf() - val visitedModules = mutableSetOf() - val modulesQueue = ArrayDeque() - modulesQueue.add(module) - - while (modulesQueue.isNotEmpty()) { - val currentModule = modulesQueue.removeFirst() - if (!visitedModules.add(currentModule)) continue - sortedModules.add(currentModule) - modulesQueue += currentModule.allDependsOn - } - - return sortedModules.reversed() - } - companion object { private fun Set.allDependencies() = if (size == 1) first().allDependencies else flatMapToSet { it.allDependencies } private fun Set.allFriends() = if (size == 1) first().allFriends else flatMapToSet { it.allFriends } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt index cce07c704fc..de626fb4a6e 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/ExtTestCaseGroupProvider.kt @@ -12,7 +12,6 @@ import com.intellij.pom.PomModel import com.intellij.pom.core.impl.PomModelImpl import com.intellij.pom.tree.TreeAspect import com.intellij.psi.impl.source.tree.TreeCopyHandler -import org.jetbrains.kotlin.ObsoleteTestInfrastructure import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment @@ -658,8 +657,7 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te destination = TestModule.Exclusive( name = extTestModule.name, directDependencySymbols = extTestModule.dependencies.mapToSet(::transformDependency), - directFriendSymbols = extTestModule.friends.mapToSet(::transformDependency), - directDependsOnSymbols = extTestModule.dependsOn.mapToSet(::transformDependency), + directFriendSymbols = extTestModule.friends.mapToSet(::transformDependency) ), baseDir = testCaseDir ) { module, file -> module.files += file } @@ -706,15 +704,11 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te private fun checkModulesConsistency() { filesAndModules.modules.values.forEach { module -> val unknownFriends = (module.friendsSymbols + module.friends.map { it.name }).toSet() - filesAndModules.modules.keys + assertTrue(unknownFriends.isEmpty()) { "Module $module has unknown friends: $unknownFriends" } val unknownDependencies = (module.dependenciesSymbols + module.dependencies.map { it.name }).toSet() - filesAndModules.modules.keys - - val unknownDependsOn = - (module.dependsOnSymbols + module.dependsOn.map { it.name }).toSet() - filesAndModules.modules.keys - - val unknownAllDependencies = unknownDependencies + unknownFriends + unknownDependsOn - assertTrue(unknownAllDependencies.isEmpty()) { "Module $module has unknown dependencies: $unknownAllDependencies" } + assertTrue(unknownDependencies.isEmpty()) { "Module $module has unknown dependencies: $unknownDependencies" } assertTrue(module.files.isNotEmpty()) { "Module $module has no files" } } @@ -724,9 +718,8 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te private class ExtTestModule( name: String, dependencies: List, - friends: List, - dependsOn: List, // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter - ) : KotlinBaseTest.TestModule(name, dependencies, friends, dependsOn) { + friends: List + ) : KotlinBaseTest.TestModule(name, dependencies, friends) { val files = mutableListOf() val isSupport get() = name == SUPPORT_MODULE_NAME @@ -753,7 +746,6 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te override fun hashCode() = name.hashCode() * 31 + module.hashCode() } - @OptIn(ObsoleteTestInfrastructure::class) private class ExtTestFileFactory : TestFiles.TestFileFactory { private val defaultModule by lazy { createModule(DEFAULT_MODULE_NAME, emptyList(), emptyList(), emptyList()) } private val supportModule by lazy { createModule(SUPPORT_MODULE_NAME, emptyList(), emptyList(), emptyList()) } @@ -772,14 +764,13 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te ) } - override fun createModule(name: String, dependencies: List, friends: List, dependsOn: List): ExtTestModule = - ExtTestModule(name, dependencies, friends, dependsOn) + override fun createModule(name: String, dependencies: List, friends: List, abiVersions: List): ExtTestModule = + ExtTestModule(name, dependencies, friends) } private inner class FilesAndModules(originalTestDataFile: File, sourceTransformers: ExternalSourceTransformers) { private val testFileFactory = ExtTestFileFactory() - @OptIn(ObsoleteTestInfrastructure::class) private val generatedFiles = TestFiles.createTestFiles( /* testFileName = */ DEFAULT_FILE_NAME, /* expectedText = */ originalTestDataFile.readText(), diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/PredefinedTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/PredefinedTestCaseGroupProvider.kt index 8a196d5a14c..3d46db29595 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/PredefinedTestCaseGroupProvider.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/group/PredefinedTestCaseGroupProvider.kt @@ -49,8 +49,7 @@ internal class PredefinedTestCaseGroupProvider(annotation: PredefinedTestCases) val module = TestModule.Exclusive( name = testCaseId.uniqueName, directDependencySymbols = emptySet(), - directFriendSymbols = emptySet(), - directDependsOnSymbols = emptySet(), + directFriendSymbols = emptySet() ) val ignoredFiles = predefinedTestCase.ignoredFiles.map { it.absoluteNormalizedFile() } diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/ScriptJvmCompilerImpls.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/ScriptJvmCompilerImpls.kt index 05d686563cc..2099a709c54 100644 --- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/ScriptJvmCompilerImpls.kt +++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/ScriptJvmCompilerImpls.kt @@ -29,7 +29,6 @@ import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar import org.jetbrains.kotlin.fir.pipeline.* import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil import org.jetbrains.kotlin.modules.TargetId -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.CommonPlatforms import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.psi.KtFile @@ -357,7 +356,7 @@ private fun doCompileWithK2( friendPaths = emptyList() ) val session = prepareJvmSessions( - sourceFiles, kotlinCompilerConfiguration, projectEnvironment, Name.identifier(rootModuleName), extensionRegistrars, + sourceFiles, kotlinCompilerConfiguration, projectEnvironment, rootModuleName, extensionRegistrars, librariesScope, libraryList, isCommonSourceForPsi, fileBelongsToModuleForPsi, createProviderAndScopeForIncrementalCompilation = { files -> createContextForIncrementalCompilation(