diff --git a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/resolve/extensions/KtResolveExtensionTestSupport.kt b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/resolve/extensions/KtResolveExtensionTestSupport.kt index d35767f993d..805d9a5f6f0 100644 --- a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/resolve/extensions/KtResolveExtensionTestSupport.kt +++ b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/resolve/extensions/KtResolveExtensionTestSupport.kt @@ -18,6 +18,7 @@ import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer import org.jetbrains.kotlin.test.model.TestFile import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.DefaultsProvider import org.jetbrains.kotlin.test.services.ModuleStructureTransformer import org.jetbrains.kotlin.test.services.TestModuleStructure import org.jetbrains.kotlin.test.services.TestServices @@ -59,7 +60,7 @@ object KtResolveExtensionTestSupport { private class ResolveExtensionDirectiveModuleStructureTransformer( private val testServices: TestServices, ) : ModuleStructureTransformer() { - override fun transformModuleStructure(moduleStructure: TestModuleStructure): TestModuleStructure { + override fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure { check(Directives.WITH_RESOLVE_EXTENSION in moduleStructure.allDirectives) { "configureResolveExtensions() was called, but no modules specify WITH_RESOLVE_EXTENSION." } @@ -138,4 +139,4 @@ object KtResolveExtensionTestSupport { useDirectives(Directives) useModuleStructureTransformers(KtResolveExtensionTestSupport::ResolveExtensionDirectiveModuleStructureTransformer) } -} \ No newline at end of file +} diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/ModuleStructureTransformer.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/ModuleStructureTransformer.kt index 644478191d5..14f7fd72ac9 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/ModuleStructureTransformer.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/services/ModuleStructureTransformer.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.test.TestInfrastructureInternals @TestInfrastructureInternals abstract class ModuleStructureTransformer { - abstract fun transformModuleStructure(moduleStructure: TestModuleStructure): TestModuleStructure + abstract fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure } class ExceptionFromModuleStructureTransformer( diff --git a/compiler/testData/diagnostics/tests/multiplatform/checkNoActualForExpectInLastModule.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/checkNoActualForExpectInLastModule.fir.kt index d0d72bc1d38..4353b4292ed 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/checkNoActualForExpectInLastModule.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/checkNoActualForExpectInLastModule.fir.kt @@ -1,4 +1,4 @@ // ISSUE: KT-58483 // MODULE: jvm // FILE: jvm.kt -expect class A +expect class A diff --git a/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.fir.kt index 6797b88127c..a5bbb7163b4 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.fir.kt @@ -1,7 +1,7 @@ // MODULE: m1-common // FILE: common.kt -expect enum class En(x: Int) { +expect enum class En(x: Int) { E1, E2(42), ; @@ -9,6 +9,6 @@ constructor(s: String) } -expect enum class En2 { +expect enum class En2 { E1() } diff --git a/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.fir.kt index 49277f563dd..47c6908b07e 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.fir.kt @@ -1,7 +1,7 @@ // MODULE: m1-common // FILE: common.kt -expect enum class En { +expect enum class En { E1, E2 { fun foo() = "" diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt index 68cb5fee75f..9975ce88b09 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.fir.kt @@ -5,7 +5,7 @@ interface Foo { fun foo() } -expect class NonAbstractClass : Foo { +expect class NonAbstractClass : Foo { abstract fun bar() abstract val baz: Int @@ -13,7 +13,7 @@ interface Foo { abstract override fun foo() } -expect abstract class AbstractClass : Foo { +expect abstract class AbstractClass : Foo { abstract fun bar() abstract val baz: Int diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.fir.kt index 3fe9c4e0f72..1e32204ae7e 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.fir.kt @@ -1,12 +1,12 @@ // MODULE: m1-common // FILE: common.kt -expect open class A { +expect open class A { constructor(s: String) constructor(n: Number) : this("A") } -expect class B : A { +expect class B : A { constructor(i: Int) constructor() : super("B") diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.fir.kt index 44b93bf4283..807affa7d9f 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.fir.kt @@ -1,10 +1,10 @@ // MODULE: m1-common // FILE: common.kt -expect abstract class BaseA() { +expect abstract class BaseA() { abstract fun foo() -} -expect open class BaseAImpl() : BaseA +} +expect open class BaseAImpl() : BaseA class DerivedA1 : BaseAImpl() class DerivedA2 : BaseAImpl() { @@ -13,10 +13,10 @@ class DerivedA2 : BaseAImpl() { -expect interface BaseB { +expect interface BaseB { fun foo() -} -expect open class BaseBImpl() : BaseB +} +expect open class BaseBImpl() : BaseB class DerivedB1 : BaseBImpl() class DerivedB2 : BaseBImpl() { @@ -25,10 +25,10 @@ class DerivedB2 : BaseBImpl() { -expect interface BaseC { +expect interface BaseC { fun foo() -} -expect abstract class BaseCImpl() : BaseC +} +expect abstract class BaseCImpl() : BaseC class DerivedC1 : BaseCImpl() class DerivedC2 : BaseCImpl() { @@ -37,35 +37,35 @@ class DerivedC2 : BaseCImpl() { -expect interface BaseD { +expect interface BaseD { fun foo() -} +} abstract class BaseDImpl() : BaseD { fun bar() = super.foo() } -expect interface BaseE { +expect interface BaseE { fun foo() -} +} sealed class BaseEImpl() : BaseE { fun bar() = super.foo() } -expect interface BaseF { +expect interface BaseF { fun foo() -} -expect class BaseFImpl() : BaseF +} +expect class BaseFImpl() : BaseF -expect abstract class BaseG() { +expect abstract class BaseG() { abstract fun foo() -} -expect open class BaseGImpl() : BaseG { +} +expect open class BaseGImpl() : BaseG { override fun foo() -} +} class DerivedG1 : BaseGImpl() diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.ll.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.ll.kt deleted file mode 100644 index 807affa7d9f..00000000000 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.ll.kt +++ /dev/null @@ -1,71 +0,0 @@ -// MODULE: m1-common -// FILE: common.kt - -expect abstract class BaseA() { - abstract fun foo() -} -expect open class BaseAImpl() : BaseA - -class DerivedA1 : BaseAImpl() -class DerivedA2 : BaseAImpl() { - override fun foo() = super.foo() -} - - - -expect interface BaseB { - fun foo() -} -expect open class BaseBImpl() : BaseB - -class DerivedB1 : BaseBImpl() -class DerivedB2 : BaseBImpl() { - override fun foo() = super.foo() -} - - - -expect interface BaseC { - fun foo() -} -expect abstract class BaseCImpl() : BaseC - -class DerivedC1 : BaseCImpl() -class DerivedC2 : BaseCImpl() { - override fun foo() = super.foo() -} - - - -expect interface BaseD { - fun foo() -} -abstract class BaseDImpl() : BaseD { - fun bar() = super.foo() -} - - - -expect interface BaseE { - fun foo() -} -sealed class BaseEImpl() : BaseE { - fun bar() = super.foo() -} - - - -expect interface BaseF { - fun foo() -} -expect class BaseFImpl() : BaseF - - - -expect abstract class BaseG() { - abstract fun foo() -} -expect open class BaseGImpl() : BaseG { - override fun foo() -} -class DerivedG1 : BaseGImpl() diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.fir.kt index 3b343205a6b..7c5d3590bb0 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.fir.kt @@ -1,6 +1,6 @@ // MODULE: m1-common // FILE: common.kt -expect class Foo { +expect class Foo { init { "no" } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/inheritanceByDelegationInExpectClass.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/inheritanceByDelegationInExpectClass.fir.kt index 847807be755..ebf592482db 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/inheritanceByDelegationInExpectClass.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/inheritanceByDelegationInExpectClass.fir.kt @@ -4,6 +4,6 @@ interface A class B : A -expect class Foo(b: B) : A by b +expect class Foo(b: B) : A by b -expect class Bar : A by B() +expect class Bar : A by B() diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.fir.kt index e091de9a449..573cdc0b4f1 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/memberPropertyKinds.fir.kt @@ -1,7 +1,7 @@ // MODULE: m1-common // FILE: common.kt -expect class Foo { +expect class Foo { val justVal: String var justVar: String diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.fir.kt index 7661dd8c085..6c4a970d517 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/smartCastOnExpectClass.fir.kt @@ -1,7 +1,7 @@ // MODULE: m1-common // FILE: common.kt -expect class Foo { // also, it's important that Foo doesn't override equals +expect class Foo { // also, it's important that Foo doesn't override equals fun foo() } diff --git a/compiler/testData/diagnostics/tests/multiplatform/incompatibles.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/incompatibles.fir.kt index 64ab9d14d68..fa8e317cf09 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/incompatibles.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/incompatibles.fir.kt @@ -1,12 +1,12 @@ -header impl class First +header impl class First -header expect class Second +header expect class Second -header actual class Third +header actual class Third -impl expect class Fourth +impl expect class Fourth impl actual class Fifth -expect actual class Sixth +expect actual class Sixth diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingHeaderDeclarations.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingHeaderDeclarations.fir.kt index f87e53ebf27..f91c08899de 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingHeaderDeclarations.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingHeaderDeclarations.fir.kt @@ -1,7 +1,7 @@ // MODULE: m1-common // FILE: common.kt -expect fun foo() -expect fun foo() +expect fun foo() +expect fun foo() -expect fun foo(x: Int) +expect fun foo(x: Int) diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.fir.kt index 583c8257ae5..ff32fd4583d 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.fir.kt @@ -1,8 +1,8 @@ // MODULE: m1-common // FILE: common.kt -expect fun foo() +expect fun foo() -expect fun foo() {} +expect fun foo() {} -expect fun bar() {} +expect fun bar() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerWithoutImpl.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerWithoutImpl.fir.kt index 243664b3dee..9e510dfd468 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerWithoutImpl.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerWithoutImpl.fir.kt @@ -1,4 +1,4 @@ // MODULE: m1-common // FILE: common.kt -expect fun foo() +expect fun foo() diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.fir.kt index ff63aa648e2..963dd02f09f 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.fir.kt @@ -2,35 +2,35 @@ // MODULE: m1-common // FILE: common.kt -expect val justVal: String -expect var justVar: String +expect val justVal: String +expect var justVar: String -expect val String.extensionVal: Unit -expect var T.genericExtensionVar: T +expect val String.extensionVal: Unit +expect var T.genericExtensionVar: T -expect val valWithGet: String +expect val valWithGet: String get -expect var varWithGetSet: String +expect var varWithGetSet: String get set -expect var varWithPlatformGetSet: String +expect var varWithPlatformGetSet: String expect get expect set -expect val backingFieldVal: String = "no" -expect var backingFieldVar: String = "no" +expect val backingFieldVal: String = "no" +expect var backingFieldVar: String = "no" -expect val customAccessorVal: String +expect val customAccessorVal: String get() = "no" -expect var customAccessorVar: String +expect var customAccessorVar: String get() = "no" set(value) {} -expect const val constVal: Int +expect const val constVal: Int -expect lateinit var lateinitVar: String +expect lateinit var lateinitVar: String -expect val delegated: String by Delegate +expect val delegated: String by Delegate object Delegate { operator fun getValue(x: Any?, y: Any?): String = "" } fun test(): String { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt index 764bb531571..4709c379816 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt @@ -34,14 +34,11 @@ import org.jetbrains.kotlin.test.model.AfterAnalysisChecker import org.jetbrains.kotlin.test.model.DependencyKind import org.jetbrains.kotlin.test.model.FrontendFacade import org.jetbrains.kotlin.test.model.FrontendKinds -import org.jetbrains.kotlin.test.services.LibraryProvider -import org.jetbrains.kotlin.test.services.TestService -import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.* import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator import org.jetbrains.kotlin.test.services.configuration.ScriptingEnvironmentConfigurator import org.jetbrains.kotlin.test.services.fir.FirOldFrontendMetaConfigurator -import org.jetbrains.kotlin.test.services.service import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider @@ -111,7 +108,7 @@ abstract class AbstractFirWithActualizerDiagnosticsTest(val parser: FirParser) : useAdditionalService(::LibraryProvider) @OptIn(TestInfrastructureInternals::class) - useModuleStructureTransformers(DuplicateFileNameChecker) + useModuleStructureTransformers(DuplicateFileNameChecker, PlatformModuleProvider) } } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/DuplicateFileNameChecker.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/DuplicateFileNameChecker.kt index 0c0c9850cb7..f94e052e205 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/DuplicateFileNameChecker.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/DuplicateFileNameChecker.kt @@ -6,13 +6,14 @@ package org.jetbrains.kotlin.test.runners import org.jetbrains.kotlin.test.TestInfrastructureInternals +import org.jetbrains.kotlin.test.services.DefaultsProvider import org.jetbrains.kotlin.test.services.ModuleStructureTransformer import org.jetbrains.kotlin.test.services.TestModuleStructure // TODO remove when duplicate files names are supported by prefix their path with the module name KT-63252 @OptIn(TestInfrastructureInternals::class) object DuplicateFileNameChecker : ModuleStructureTransformer() { - override fun transformModuleStructure(moduleStructure: TestModuleStructure): TestModuleStructure { + override fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure { val files = mutableSetOf() for (module in moduleStructure.modules) { @@ -25,4 +26,4 @@ object DuplicateFileNameChecker : ModuleStructureTransformer() { return moduleStructure } -} \ No newline at end of file +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/ModuleTransformerForSwitchingBackend.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/ModuleTransformerForSwitchingBackend.kt index e2e6f69bc36..729b16c664d 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/ModuleTransformerForSwitchingBackend.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/ModuleTransformerForSwitchingBackend.kt @@ -19,7 +19,7 @@ class ModuleTransformerForSwitchingBackend( val backendForLib: TargetBackend, val backendForMain: TargetBackend ) : ModuleStructureTransformer() { - override fun transformModuleStructure(moduleStructure: TestModuleStructure): TestModuleStructure { + override fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure { if (moduleStructure.modules.size != 2) error("Test should contain only one module") val (first, second) = moduleStructure.modules diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/PlatformModuleProvider.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/PlatformModuleProvider.kt new file mode 100644 index 00000000000..a03ee15f69b --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/PlatformModuleProvider.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.services + +import org.jetbrains.kotlin.test.TestInfrastructureInternals +import org.jetbrains.kotlin.test.model.DependencyDescription +import org.jetbrains.kotlin.test.model.DependencyRelation +import org.jetbrains.kotlin.test.services.impl.TestModuleStructureImpl + +/** + * This provider adds additional empty module platform module if there is only one module in the module structure with common platform + * + * ``` + * // MODULE: some + * ``` + * converted to + * ``` + * // MODULE: some + * ... + * // MODULE: platform()()(some) + * ``` + * + * This is needed for MPP diagnostic tests, which sometimes omit specifying platform module, which causes Fir2Ir facade skip + * IR actualizer, since there is only one module at all + */ +@OptIn(TestInfrastructureInternals::class) +object PlatformModuleProvider : ModuleStructureTransformer() { + override fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure { + val module = moduleStructure.modules.singleOrNull() ?: return moduleStructure + val dependency = DependencyDescription(module.name, defaultsProvider.defaultDependencyKind, DependencyRelation.DependsOnDependency) + val platformModule = module.copy( + name = "${module.name}-platform", + targetPlatform = defaultsProvider.defaultPlatform, + allDependencies = listOf(dependency), + files = emptyList() + ) + return TestModuleStructureImpl(listOf(module, platformModule), moduleStructure.originalTestDataFiles) + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/SplittingModuleTransformerForBoxTests.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/SplittingModuleTransformerForBoxTests.kt index e979c1c26ab..4dc5832e7d8 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/SplittingModuleTransformerForBoxTests.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/SplittingModuleTransformerForBoxTests.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.test.services.impl.TestModuleStructureImpl */ @TestInfrastructureInternals class SplittingModuleTransformerForBoxTests : ModuleStructureTransformer() { - override fun transformModuleStructure(moduleStructure: TestModuleStructure): TestModuleStructure { + override fun transformModuleStructure(moduleStructure: TestModuleStructure, defaultsProvider: DefaultsProvider): TestModuleStructure { if (moduleStructure.modules.size > 1) { // The test is already multimodule, no need to split it into modules further. return moduleStructure diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt index 66f2c101f4b..1b0125797be 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/impl/ModuleStructureExtractorImpl.kt @@ -65,7 +65,7 @@ class ModuleStructureExtractorImpl( var result = extractor.splitTestDataByModules() for (transformer in moduleStructureTransformers) { result = try { - transformer.transformModuleStructure(result) + transformer.transformModuleStructure(result, testServices.defaultsProvider) } catch (e: Throwable) { throw ExceptionFromModuleStructureTransformer(e, result) } @@ -73,7 +73,7 @@ class ModuleStructureExtractorImpl( return result } - private inner class ModuleStructureExtractorWorker constructor( + private inner class ModuleStructureExtractorWorker( private val testDataFiles: List, private val directivesContainer: DirectivesContainer, ) {