From eb8e54b5174553470b6ecd476a4018e8a0397c77 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Tue, 10 Mar 2020 13:22:42 +0300 Subject: [PATCH] Check IR version support --- .../kotlin/cli/bc/K2NativeCompilerArguments.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt index 69b1def3542..c1ba40b35bf 100644 --- a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt +++ b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt @@ -7,9 +7,9 @@ package org.jetbrains.kotlin.cli.bc import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.Argument +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector -import org.jetbrains.kotlin.config.AnalysisFlag -import org.jetbrains.kotlin.config.AnalysisFlags +import org.jetbrains.kotlin.config.* class K2NativeCompilerArguments : CommonCompilerArguments() { // First go the options interesting to the general public. @@ -255,6 +255,17 @@ class K2NativeCompilerArguments : CommonCompilerArguments() { if (printIr) phasesToDumpAfter = arrayOf("ALL") } + + override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) { + if (languageVersionSettings.languageVersion < LanguageVersion.KOTLIN_1_4 + || languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_4 + ) { + collector.report( + severity = CompilerMessageSeverity.ERROR, + message = "Native backend cannot be used with language or API version below 1.4" + ) + } + } } const val EMBED_BITCODE_FLAG = "-Xembed-bitcode"