fixup! [Tests][JS] Avoid crash in JsIrIniningFacade
diff --git a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/TestRunner.kt b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/TestRunner.kt index c12db38..77566a8 100644 --- a/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/TestRunner.kt +++ b/compiler/test-infrastructure/tests/org/jetbrains/kotlin/test/TestRunner.kt
@@ -62,8 +62,6 @@ throw exception } - if (shouldSkipK1TestDueToEnabledUnsupportedFeature(moduleStructure)) return - testConfiguration.metaTestConfigurators.forEach { if (it.shouldSkipTest()) return } @@ -206,17 +204,4 @@ @Suppress("UNCHECKED_CAST") return processModule(module, artifact as I, thereWereExceptionsOnPreviousSteps) } - - // Skip test for K1 in case it explicitly enables any post-K1 or unstable language features - fun shouldSkipK1TestDueToEnabledUnsupportedFeature(moduleStructure: TestModuleStructure): Boolean { - moduleStructure.modules.first().languageVersionSettings.let { - if (it.languageVersion.major == 1) { - it.getManuallyEnabledLanguageFeatures().forEach { feature -> - if (feature.sinceVersion?.major == 2 || feature.kind == LanguageFeature.Kind.UNSTABLE_FEATURE) - return true - } - } - } - return false - } }
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicUnstableAndK2LanguageFeaturesSkipConfigurator.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicUnstableAndK2LanguageFeaturesSkipConfigurator.kt new file mode 100644 index 0000000..90ca2e4 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicUnstableAndK2LanguageFeaturesSkipConfigurator.kt
@@ -0,0 +1,26 @@ +/* + * Copyright 2010-2025 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.frontend.classic.handlers + +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.test.services.MetaTestConfigurator +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.moduleStructure + +// Skip test for K1 in case it explicitly enables any language feature which either has `sinceVersion` equal to 2.*, or is unstable. +class ClassicUnstableAndK2LanguageFeaturesSkipConfigurator(testServices: TestServices) : MetaTestConfigurator(testServices) { + override fun shouldSkipTest(): Boolean { + testServices.moduleStructure.modules.first().languageVersionSettings.let { + if (it.languageVersion.major == 1) { + it.getManuallyEnabledLanguageFeatures().forEach { feature -> + if (feature.sinceVersion?.major == 2 || feature.kind == LanguageFeature.Kind.UNSTABLE_FEATURE) + return true + } + } + } + return false + } +}
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractKotlinCompilerTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractKotlinCompilerTest.kt index 012d79c..db7979b 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractKotlinCompilerTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractKotlinCompilerTest.kt
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.test.builders.testRunner import org.jetbrains.kotlin.test.directives.ConfigurationDirectives import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives +import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicUnstableAndK2LanguageFeaturesSkipConfigurator import org.jetbrains.kotlin.test.model.ResultingArtifact import org.jetbrains.kotlin.test.model.TestFile import org.jetbrains.kotlin.test.preprocessors.MetaInfosCleanupPreprocessor @@ -48,7 +49,7 @@ useAdditionalService<TargetPlatformProvider>(::TargetPlatformProviderForCompilerTests) useSourcePreprocessor(*defaultPreprocessors.toTypedArray()) useDirectives(*defaultDirectiveContainers.toTypedArray()) - useMetaTestConfigurators(::SystemPropertyTestDataRootConfigurator) + useMetaTestConfigurators(::SystemPropertyTestDataRootConfigurator, ::ClassicUnstableAndK2LanguageFeaturesSkipConfigurator) configureDebugFlags() startingArtifactFactory = { ResultingArtifact.Source() } }