K2 tests: always use language version 2.0 or higher
This commit is contained in:
committed by
Space Team
parent
d9a6cad5ab
commit
fbea09b3b6
+6
-1
@@ -53,7 +53,8 @@ class LanguageVersionSettingsBuilder {
|
||||
fun configureUsingDirectives(
|
||||
directives: RegisteredDirectives,
|
||||
environmentConfigurators: List<AbstractEnvironmentConfigurator>,
|
||||
targetBackend: TargetBackend?
|
||||
targetBackend: TargetBackend?,
|
||||
useK2: Boolean
|
||||
) {
|
||||
val apiVersion = directives.singleOrZeroValue(LanguageSettingsDirectives.API_VERSION)
|
||||
if (apiVersion != null) {
|
||||
@@ -61,6 +62,10 @@ class LanguageVersionSettingsBuilder {
|
||||
val languageVersion = maxOf(LanguageVersion.LATEST_STABLE, LanguageVersion.fromVersionString(apiVersion.versionString)!!)
|
||||
this.languageVersion = languageVersion
|
||||
}
|
||||
when {
|
||||
useK2 && this.languageVersion < LanguageVersion.KOTLIN_2_0 -> this.languageVersion = LanguageVersion.KOTLIN_2_0
|
||||
!useK2 && this.languageVersion > LanguageVersion.KOTLIN_1_9 -> this.languageVersion = LanguageVersion.KOTLIN_1_9
|
||||
}
|
||||
|
||||
val analysisFlags = listOfNotNull(
|
||||
analysisFlag(AnalysisFlags.optIn, directives[LanguageSettingsDirectives.OPT_IN].takeIf { it.isNotEmpty() }),
|
||||
|
||||
+5
-1
@@ -334,7 +334,11 @@ class ModuleStructureExtractorImpl(
|
||||
moduleDirectives.forEach { it.checkDirectiveApplicability(contextIsGlobal = isImplicitModule, contextIsModule = true) }
|
||||
|
||||
val targetBackend = currentModuleTargetBackend ?: defaultsProvider.defaultTargetBackend
|
||||
currentModuleLanguageVersionSettingsBuilder.configureUsingDirectives(moduleDirectives, environmentConfigurators, targetBackend)
|
||||
val frontendKind = currentModuleFrontendKind ?: defaultsProvider.defaultFrontend
|
||||
|
||||
currentModuleLanguageVersionSettingsBuilder.configureUsingDirectives(
|
||||
moduleDirectives, environmentConfigurators, targetBackend, useK2 = frontendKind == FrontendKinds.FIR
|
||||
)
|
||||
val moduleName = currentModuleName
|
||||
?: testServices.defaultDirectives[ModuleStructureDirectives.MODULE].firstOrNull()
|
||||
?: DEFAULT_MODULE_NAME
|
||||
|
||||
Reference in New Issue
Block a user