Language version 2.0: fix compiler messages and minor details

This commit is contained in:
Mikhail Glukhikh
2023-01-09 11:51:48 +01:00
parent cbedbda527
commit 7a61578e08
12 changed files with 19 additions and 21 deletions
@@ -104,19 +104,19 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
arguments.languageVersion == null -> {
messageCollector.report(
STRONG_WARNING,
"Compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead"
"Compiler flag -Xuse-k2 is deprecated, please use \"-language-version 2.0\" instead"
)
}
languageVersion.usesK2 -> {
messageCollector.report(
STRONG_WARNING,
"Compiler flag -Xuse-k2 is redundant"
"Compiler flag -Xuse-k2 is redundant, the \"-language-version 2.0\" is used instead"
)
}
else -> {
messageCollector.report(
STRONG_WARNING,
"With -Xuse-k2 compiler flag -language-version $languageVersion has no effect, please remove -Xuse-k2 flag or use -language-version 2.0 instead"
"With -Xuse-k2 compiler flag \"-language-version $languageVersion\" has no effect, please remove -Xuse-k2 flag and use \"-language-version 2.0\" instead"
)
}
}
@@ -202,7 +202,8 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
val pluginConfigurations = arguments.pluginConfigurations.orEmpty().toMutableList()
val messageCollector = configuration.getNotNull(MESSAGE_COLLECTOR_KEY)
if (!checkPluginsArguments(messageCollector, arguments.useK2, pluginClasspaths, pluginOptions, pluginConfigurations)) {
val useK2 = configuration.get(CommonConfigurationKeys.USE_FIR) == true
if (!checkPluginsArguments(messageCollector, useK2, pluginClasspaths, pluginOptions, pluginConfigurations)) {
return INTERNAL_ERROR
}
@@ -274,7 +275,7 @@ fun checkPluginsArguments(
hasErrors = true
messageCollector.report(
ERROR,
"-Xcompiler-plugin argument is allowed only for for K2 compiler. Please use -Xplugin argument or enable -Xuse-k2"
"-Xcompiler-plugin argument is allowed only for language version 2.0. Please use -Xplugin argument for language version 1.9 and below"
)
}
if (pluginClasspaths.isNotEmpty() || pluginOptions.isNotEmpty()) {
@@ -86,7 +86,7 @@ object FirKotlinToJvmBytecodeCompiler {
"""
|There are some plugins incompatible with language version 2.0:
|${notSupportedPlugins.joinToString(separator = "\n|") { " $it" }}
|Please use language version 1.* (e.g. 1.9)
|Please use language version 1.9 or below
""".trimMargin()
)
return false
@@ -59,7 +59,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
): ExitCode {
val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
collector.report(ERROR, "Compilation to metadata is not supported in language version 2.0 right now")
collector.report(ERROR, "Compilation to metadata is not supported with language version 2.0 right now")
return ExitCode.COMPILATION_ERROR
}
val performanceManager = configuration.getNotNull(CLIConfigurationKeys.PERF_MANAGER)