diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt index 321bef33521..2111c99ed0b 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/AbstractKeywordCompletionTest.kt @@ -23,9 +23,9 @@ abstract class AbstractKeywordCompletionTest : KotlinFixtureCompletionBaseTestCa } override fun getProjectDescriptor(): KotlinLightProjectDescriptor = when { - "LangLevel10" in fileName() -> KotlinProjectDescriptorWithFacet.KOTLIN_10 - "LangLevel11" in fileName() -> KotlinProjectDescriptorWithFacet.KOTLIN_11 - else -> KotlinProjectDescriptorWithFacet.KOTLIN_STABLE_WITH_MULTIPLATFORM + "LangLevel10" in fileName() -> KotlinProjectDescriptorWithFacet.KOTLIN_10.apply { replicateToFacetSettings() } + "LangLevel11" in fileName() -> KotlinProjectDescriptorWithFacet.KOTLIN_11.apply { replicateToFacetSettings() } + else -> KotlinProjectDescriptorWithFacet.KOTLIN_STABLE_WITH_MULTIPLATFORM.apply { replicateToFacetSettings() } } override fun defaultInvocationCount() = 1 diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinProjectDescriptorWithFacet.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinProjectDescriptorWithFacet.kt index c7d83284686..0eca6dd6eac 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinProjectDescriptorWithFacet.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinProjectDescriptorWithFacet.kt @@ -30,13 +30,25 @@ class KotlinProjectDescriptorWithFacet( private val languageVersion: LanguageVersion, private val multiPlatform: Boolean = false ) : KotlinLightProjectDescriptor() { + + private var facetConfig: KotlinFacetConfiguration? = null + override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) { configureKotlinFacet(module) { - settings.languageLevel = languageVersion - if (multiPlatform) { - settings.compilerSettings = CompilerSettings().apply { - additionalArguments += " -Xmulti-platform" - } + facetConfig = this + toFacetConfig(this) + } + } + + fun replicateToFacetSettings() { + facetConfig?.let { toFacetConfig(it) } + } + + private fun toFacetConfig(configuration: KotlinFacetConfiguration) { + configuration.settings.languageLevel = languageVersion + if (multiPlatform) { + configuration.settings.compilerSettings = CompilerSettings().apply { + additionalArguments += " -Xmulti-platform" } } }