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 d35b0a68b21..937920ce829 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.asString(), + ktFiles, moduleStructure.compilerConfiguration, escapedMainModuleName, 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 33b6f2a14a8..0c5e3307383 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: String, + rootModuleName: Name, extensionRegistrars: List, librariesScope: AbstractProjectFileSearchScope, libraryList: DependencyListForCliModule, @@ -70,7 +70,7 @@ fun prepareJvmSessions( JvmPlatformAnalyzerServices, libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirJvmSessionFactory.createLibrarySession( - Name.identifier(rootModuleName), + rootModuleName, sessionProvider, libraryList.moduleDataProvider, projectEnvironment, @@ -109,7 +109,7 @@ fun prepareJvmSessions( fun prepareJsSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: String, + rootModuleName: Name, resolvedLibraries: List, libraryList: DependencyListForCliModule, extensionRegistrars: List, @@ -121,7 +121,7 @@ fun prepareJsSessions( libraryList, isCommonSource, fileBelongsToModule, createLibrarySession = { sessionProvider -> FirJsSessionFactory.createLibrarySession( - Name.identifier(rootModuleName), + rootModuleName, resolvedLibraries, sessionProvider, libraryList.moduleDataProvider, @@ -152,7 +152,7 @@ fun prepareJsSessions( fun prepareNativeSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: String, + rootModuleName: Name, 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( - Name.identifier(rootModuleName), + rootModuleName, resolvedLibraries, sessionProvider, libraryList.moduleDataProvider, @@ -193,7 +193,7 @@ fun prepareCommonSessions( files: List, configuration: CompilerConfiguration, projectEnvironment: AbstractProjectEnvironment, - rootModuleName: String, + rootModuleName: Name, 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( - Name.identifier(rootModuleName), + rootModuleName, sessionProvider, libraryList.moduleDataProvider, projectEnvironment, @@ -240,7 +240,7 @@ private typealias FirSessionProducer = (List, FirModuleData, FirProjectSes private inline fun prepareSessions( files: List, configuration: CompilerConfiguration, - rootModuleName: String, + rootModuleName: Name, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, libraryList: DependencyListForCliModule, @@ -277,7 +277,7 @@ private inline fun prepareSessions( ) else -> createSessionsForHmppProject( - files, hmppModuleStructure, libraryList, targetPlatform, analyzerServices, + files, rootModuleName, hmppModuleStructure, libraryList, targetPlatform, analyzerServices, sessionProvider, sessionConfigurator, fileBelongsToModule, createSourceSession ) } @@ -285,7 +285,7 @@ private inline fun prepareSessions( private inline fun createSessionForNonMppProject( files: List, - rootModuleName: String, + rootModuleName: Name, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, @@ -294,7 +294,7 @@ private inline fun createSessionForNonMppProject( createFirSession: FirSessionProducer, ): SessionWithSources { val platformModuleData = FirModuleDataImpl( - Name.identifier(rootModuleName), + rootModuleName, libraryList.regularDependencies, dependsOnDependencies = emptyList(), libraryList.friendsDependencies, @@ -308,7 +308,7 @@ private inline fun createSessionForNonMppProject( private inline fun createSessionsForLegacyMppProject( files: List, - rootModuleName: String, + rootModuleName: Name, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, analyzerServices: PlatformDependentAnalyzerServices, @@ -318,7 +318,7 @@ private inline fun createSessionsForLegacyMppProject( createFirSession: FirSessionProducer, ): List> { val commonModuleData = FirModuleDataImpl( - Name.identifier("${rootModuleName}-common"), + Name.identifier("${rootModuleName.asString()}-common"), libraryList.regularDependencies, listOf(), libraryList.friendsDependencies, @@ -327,7 +327,7 @@ private inline fun createSessionsForLegacyMppProject( ) val platformModuleData = FirModuleDataImpl( - Name.identifier(rootModuleName), + rootModuleName, libraryList.regularDependencies, listOf(commonModuleData), libraryList.friendsDependencies, @@ -352,6 +352,7 @@ private inline fun createSessionsForLegacyMppProject( private inline fun createSessionsForHmppProject( files: List, + rootModuleName: Name, hmppModuleStructure: HmppCliModuleStructure, libraryList: DependencyListForCliModule, targetPlatform: TargetPlatform, @@ -368,7 +369,7 @@ private inline fun createSessionsForHmppProject( ?.map { moduleDataForHmppModule.getValue(it) } .orEmpty() val moduleData = FirModuleDataImpl( - Name.identifier(module.name), + rootModuleName, 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 8a27e53660b..0f41d820107 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,6 +44,7 @@ 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 @@ -200,7 +201,7 @@ object FirKotlinToJvmBytecodeCompiler { val rootModuleName = module.getModuleName() val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, module.getFriendPaths()) val sessionsWithSources = prepareJvmSessions( - ktFiles, moduleConfiguration, projectEnvironment, rootModuleName, + ktFiles, moduleConfiguration, projectEnvironment, Name.identifier(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 9032cb8c70d..5cf52ec5074 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,6 +65,7 @@ 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 @@ -326,7 +327,7 @@ fun compileModuleToAnalyzedFir( // TODO: handle friends paths val libraryList = createLibraryListForJvm(rootModuleName, moduleConfiguration, friendPaths = emptyList()) val sessionWithSources = prepareJvmSessions( - allSources, moduleConfiguration, projectEnvironment, rootModuleName, + allSources, moduleConfiguration, projectEnvironment, Name.identifier(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 0920d3b19fb..9361e84ab93 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt @@ -57,12 +57,11 @@ internal class FirMetadataSerializer( val configuration = environment.configuration val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) - val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>") + val rootModuleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>") val isLightTree = configuration.getBoolean(CommonConfigurationKeys.USE_LIGHT_TREE) - val rootModuleName = moduleName.asString() val binaryModuleData = BinaryModuleData.initialize( - Name.identifier(rootModuleName), + rootModuleName, CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices ) diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt index 9403585698f..ba3414b4412 100644 --- a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/expectClassActualTypeAlias2.kt @@ -1,4 +1,3 @@ -// 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 419afed9848..1b4bc38228f 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/typeAlias2.kt @@ -1,7 +1,6 @@ // !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 5fb83bbbc4a..263d657ec53 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/annotations/optionalExpectation.kt @@ -1,8 +1,10 @@ // !LANGUAGE: +MultiPlatformProjects // !OPT_IN: kotlin.ExperimentalMultiplatform -// IGNORE_BACKEND: NATIVE, WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND: WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE // 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 9e48f4c5527..dbb7bb3fd4b 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/basic/expectProperty.kt @@ -1,5 +1,4 @@ // !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 cee100884b1..f667ab6f5f7 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE // 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 9b48968c477..30b42191e12 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/bothInExpectAndActual2.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE // 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 0765858f9ed..67c0738756e 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/constructor.kt @@ -1,5 +1,4 @@ // !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 9544bf94d75..19a1cdbdabb 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/delegatedExpectedInterface.kt @@ -1,5 +1,4 @@ // !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 d7b3aacad72..31670996d58 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/dispatchReceiverValue.kt @@ -1,5 +1,7 @@ -// IGNORE_BACKEND: JS_IR, JS_IR_ES6, NATIVE, WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS +// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, NATIVE +// KT-57181 +// IGNORE_BACKEND_K2: NATIVE // 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 9ba6bcca385..f1c3ee477e1 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/extensionReceiverValue.kt @@ -1,5 +1,4 @@ // !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 0ced3bd3244..4c6b08fba91 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/function.kt @@ -1,5 +1,4 @@ // !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 36e3e1a4cc0..a403c3b6ddf 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/functionFromOtherModule.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE +// KT-57181 +// IGNORE_BACKEND_K2: NATIVE // 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 39ec2a0de12..3b10d633d49 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromCommonClass.kt @@ -1,5 +1,4 @@ // !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 12057d541c7..8f9185a0989 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedClass.kt @@ -1,5 +1,4 @@ // !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 c87558690d5..0e5b30d9885 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedInterface.kt @@ -1,5 +1,4 @@ // !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 05f2e18dbc4..64593ef9cc0 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedFromExpectedMethod.kt @@ -1,5 +1,4 @@ // !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 54b8b21b4c9..589bfa8dd69 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedInExpectedDeclarations.kt @@ -1,5 +1,4 @@ // !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 75ed917461a..b5102ecdd85 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt @@ -1,5 +1,4 @@ // !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 290b0fc96d9..e3dca386689 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/inlineFunctionWithDefaultLambda.kt @@ -1,5 +1,4 @@ // !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 ccfbfcf190e..1737ce86e9b 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23239.kt @@ -1,5 +1,4 @@ // !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 ec65b978ce6..f5da314ced5 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/kt23739.kt @@ -1,5 +1,4 @@ // !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 7b05294063d..3fd684a1e24 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/parametersInArgumentValues.kt @@ -1,5 +1,4 @@ // !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 5a163f94fc3..b145dd8cf0a 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/suspend.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: NATIVE -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE // 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 959b162cf52..55ea09cb98b 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/typeAlias.kt @@ -1,5 +1,4 @@ // !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 733251799e6..c1c293471a6 100644 --- a/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt +++ b/compiler/testData/codegen/box/multiplatform/k2/defaultArguments/withTypeParameter.kt @@ -1,7 +1,9 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: NATIVE, WASM -// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6 +// IGNORE_BACKEND: WASM +// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE // 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 5797891695f..06a3b1f764d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt @@ -4,6 +4,7 @@ */ 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 @@ -118,6 +119,7 @@ abstract class KotlinMultiFileTestWithJava, friends: List, abiVersions: List): M? { + override fun createModule(name: String, dependencies: List, friends: List, dependsOn: 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 8ee0aeafdd7..3c01a9bc064 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,6 +5,7 @@ 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 @@ -71,6 +72,7 @@ abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment() const val TEST_FUNCTION = "box" const val DEFAULT_MODULE = "main" + @OptIn(ObsoleteTestInfrastructure::class) fun doTest( filePath: String, expectedResult: String, @@ -89,7 +91,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, abiVersions: List) = + override fun createModule(name: String, dependencies: List, friends: List, dependsOn: 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 e715711190a..e5770265237 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -108,11 +108,13 @@ abstract class KotlinBaseTest : KtUsefulTestCase() open class TestModule( @JvmField val name: String, @JvmField val dependenciesSymbols: List, - @JvmField val friendsSymbols: List + @JvmField val friendsSymbols: List, + @JvmField val dependsOnSymbols: List = listOf(), // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter ) : 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 b2b84f1d06e..80cd3e18a47 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TestFiles.java @@ -6,8 +6,10 @@ 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.*; @@ -18,11 +20,12 @@ 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, ...) + * // MODULE: name(dependency1, dependency2, ...)(friend1, friend2, ...)(dependsOn1, dependsOn2, ...) * * // FILE: name * @@ -30,7 +33,11 @@ public class TestFiles { */ private static final String MODULE_DELIMITER = ",\\s*"; - 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 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 FILE_PATTERN = Pattern.compile("//\\s*FILE:\\s*(.*)\n"); private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n"); @@ -53,11 +60,15 @@ 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 @@ -85,17 +96,20 @@ public class TestFiles { String moduleName = moduleMatcher.group(1); String moduleDependencies = moduleMatcher.group(2); String moduleFriends = moduleMatcher.group(3); - String abiVersions = moduleMatcher.group(4); + String moduleDependsOn = moduleMatcher.group(4); if (moduleName != null) { moduleName = moduleName.trim(); hasModules = true; - module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseAbiVersionsList(abiVersions)); + module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends), parseModuleList(moduleDependsOn)); 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); @@ -156,19 +170,26 @@ public class TestFiles { for (M module : modules.values()) { if (module != null) { - module.getDependencies().addAll(module.dependenciesSymbols.stream() - .map(modules::get) - .filter(Objects::nonNull) - .collect(Collectors.toList())); + 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.getFriends().addAll(module.friendsSymbols.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())); } } - return testFiles; } @@ -193,23 +214,13 @@ public class TestFiles { } private static List parseModuleList(@Nullable String dependencies) { - 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; + if (dependencies == null || StringsKt.isBlank(dependencies)) return Collections.emptyList(); + return StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0); } 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 abiVersions); + M createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List dependsOn); } public static abstract class TestFileFactoryNoModules implements TestFileFactory { @@ -227,7 +238,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 abiVersions) { + public KotlinBaseTest.TestModule createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends, @NotNull List dependsOn) { 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 5e0a4c400c6..e68a980f063 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,6 +7,7 @@ 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 @@ -111,6 +112,7 @@ 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 766087c3815..18cdb0cbaa2 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,6 +71,9 @@ 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 47e4f06b107..87ca1237a4d 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.asString(), resolvedLibraries, dependencyList, + ktFiles, configuration, mainModuleName, 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 ae09cf8bcae..836e0160fdf 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()) + val module = TestModule.Exclusive(moduleName, emptySet(), 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 d757e1a0b50..537d44f73a9 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()).apply { + val module = TestModule.Exclusive(DEFAULT_MODULE_NAME, emptySet(), 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 7c3f5477ff3..248022b9c43 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,6 +107,7 @@ 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() ) @@ -118,7 +119,8 @@ 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() + directFriendSymbols = emptySet(), + directDependsOnSymbols = 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 62b99c76bfe..db990a7b6aa 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,6 +127,7 @@ 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(), @@ -142,7 +143,8 @@ abstract class AbstractNativeKlibBinaryCompatibilityTest : AbstractNativeSimpleT val module: TestModule.Exclusive = TestModule.Exclusive( name = name, directDependencySymbols = emptySet(), - directFriendSymbols = emptySet() + directFriendSymbols = emptySet(), + directDependsOnSymbols = 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 830fe095a3a..72b84707296 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()) + val module = TestModule.Exclusive(moduleName, emptySet(), 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 14118551804..60ba0e80e8c 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,6 +80,7 @@ internal fun AbstractNativeSimpleTest.compileToStaticCache( settings = testRunSettings, freeCompilerArgs = TestCompilerArgs.EMPTY, StaticCacheCompilation.Options.Regular, + pipelineType = testRunSettings.get(), dependencies = listOf(klib.asLibraryDependency()), expectedArtifact = TestCompilationArtifact.KLIBStaticCache(cacheDir, klib) ) @@ -91,7 +92,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()) + val module = TestModule.Exclusive(moduleName, emptySet(), 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 2e55b728141..a2abe1cd6e4 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,6 +9,7 @@ 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 @@ -85,16 +86,19 @@ internal sealed class TestModule { data class Exclusive( override val name: String, val directDependencySymbols: Set, - val directFriendSymbols: Set + val directFriendSymbols: Set, + val directDependsOnSymbols: Set, // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter ) : 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 @@ -103,7 +107,9 @@ internal sealed class TestModule { } fun haveSameSymbols(other: Exclusive) = - other.directDependencySymbols == directDependencySymbols && other.directFriendSymbols == directFriendSymbols + other.directDependencySymbols == directDependencySymbols && + other.directFriendSymbols == directFriendSymbols && + other.directDependsOnSymbols == directDependsOnSymbols } data class Shared(override val name: String) : TestModule() { @@ -122,7 +128,7 @@ internal sealed class TestModule { final override fun toString() = "${javaClass.canonicalName}[name=$name]" companion object { - fun newDefaultModule() = Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet()) + fun newDefaultModule() = Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet(), emptySet()) val TestModule.allDependencies: Set get() = when (this) { @@ -136,6 +142,12 @@ 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) } } @@ -198,11 +210,13 @@ 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." } @@ -257,6 +271,7 @@ 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 21cbdb82faf..60e092c77cb 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,13 +242,14 @@ 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) + TestModule.Exclusive(name, directDependencySymbols, directFriendSymbols, directDependsOnSymbols) } return module ?: fail { @@ -259,7 +260,11 @@ internal fun parseModule(parsedDirective: RegisteredDirectivesParser.ParsedDirec } } -private val TEST_MODULE_REGEX = Regex("^([a-zA-Z0-9_]+)(\\(([a-zA-Z0-9_,]*)\\)(\\(([a-zA-Z0-9_,]*)\\))?)?$") +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 + ")?$") 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 61e4e3e1225..c206a7153e3 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,6 +8,7 @@ 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.* @@ -154,6 +155,7 @@ 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) { @@ -163,6 +165,17 @@ 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( @@ -338,6 +351,7 @@ internal class StaticCacheCompilation( settings: Settings, freeCompilerArgs: TestCompilerArgs, private val options: Options, + private val pipelineType: PipelineType, dependencies: Iterable>, expectedArtifact: KLIBStaticCache ) : BasicCompilation( @@ -367,6 +381,7 @@ 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 d736befc47f..11192cee110 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,6 +15,7 @@ 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 09ae5a44e77..3f537936eee 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,6 +11,7 @@ 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.* @@ -158,7 +159,7 @@ internal class TestCompilationFactory { LibraryCompilation( settings = settings, freeCompilerArgs = freeCompilerArgs, - sourceModules = sourceModules, + sourceModules = sourceModules.flatMapToSet { sortDependsOnTopologically(it) }, dependencies = dependencies.forKlib(), expectedArtifact = klibArtifact ) @@ -169,6 +170,7 @@ 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 ) @@ -203,6 +205,23 @@ 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 de626fb4a6e..cce07c704fc 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,6 +12,7 @@ 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 @@ -657,7 +658,8 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te destination = TestModule.Exclusive( name = extTestModule.name, directDependencySymbols = extTestModule.dependencies.mapToSet(::transformDependency), - directFriendSymbols = extTestModule.friends.mapToSet(::transformDependency) + directFriendSymbols = extTestModule.friends.mapToSet(::transformDependency), + directDependsOnSymbols = extTestModule.dependsOn.mapToSet(::transformDependency), ), baseDir = testCaseDir ) { module, file -> module.files += file } @@ -704,11 +706,15 @@ 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 - assertTrue(unknownDependencies.isEmpty()) { "Module $module has unknown dependencies: $unknownDependencies" } + + 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(module.files.isNotEmpty()) { "Module $module has no files" } } @@ -718,8 +724,9 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te private class ExtTestModule( name: String, dependencies: List, - friends: List - ) : KotlinBaseTest.TestModule(name, dependencies, friends) { + friends: List, + dependsOn: List, // mimics the name from ModuleStructureExtractorImpl, thought later converted to `-Xfragment-refines` parameter + ) : KotlinBaseTest.TestModule(name, dependencies, friends, dependsOn) { val files = mutableListOf() val isSupport get() = name == SUPPORT_MODULE_NAME @@ -746,6 +753,7 @@ 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()) } @@ -764,13 +772,14 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te ) } - override fun createModule(name: String, dependencies: List, friends: List, abiVersions: List): ExtTestModule = - ExtTestModule(name, dependencies, friends) + override fun createModule(name: String, dependencies: List, friends: List, dependsOn: List): ExtTestModule = + ExtTestModule(name, dependencies, friends, dependsOn) } 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 3d46db29595..8a196d5a14c 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,7 +49,8 @@ internal class PredefinedTestCaseGroupProvider(annotation: PredefinedTestCases) val module = TestModule.Exclusive( name = testCaseId.uniqueName, directDependencySymbols = emptySet(), - directFriendSymbols = emptySet() + directFriendSymbols = emptySet(), + directDependsOnSymbols = 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 2099a709c54..05d686563cc 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,6 +29,7 @@ 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 @@ -356,7 +357,7 @@ private fun doCompileWithK2( friendPaths = emptyList() ) val session = prepareJvmSessions( - sourceFiles, kotlinCompilerConfiguration, projectEnvironment, rootModuleName, extensionRegistrars, + sourceFiles, kotlinCompilerConfiguration, projectEnvironment, Name.identifier(rootModuleName), extensionRegistrars, librariesScope, libraryList, isCommonSourceForPsi, fileBelongsToModuleForPsi, createProviderAndScopeForIncrementalCompilation = { files -> createContextForIncrementalCompilation(