Introduce tweaks and wording changes related to LV2.0-specific CLI warnings

Fix merge conflict related to renaming of one of the tests

Regenerate tests affected by previous commit

Fix merge conflict related to renaming of one of the tests

Improve wording of the `-Xuse-k2 -language-version 1.*` CLI warning

Improve wording of LV2.0-specific CLI warnings some more

Fix output of one of the tests for -Xuse-k2 deprecation

Tweak wording of LV2.0-specific CLI warnings

* make it clear in every warning that -Xuse-k2 is deprecated
* add a reminder to remove -Xuse-k2 for `-Xuse-k2 -language-version 2.0`
* add both possibly wanted fixes for `-Xuse-k2 -language-version 1.*`

Remove deprecated -Xuse-k2 flag from one of the tests

Merge-request: KT-MR-8449
Merged-by: Stanislav Ruban <Stanislav.Ruban@jetbrains.com>
This commit is contained in:
Stanislav Ruban
2023-01-26 11:55:03 +00:00
committed by Space Team
parent f6c189be7b
commit 7e0f69b8de
5 changed files with 13 additions and 24 deletions
@@ -711,27 +711,16 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
val explicitVersion = parseVersion(collector, languageVersion, "language")
val explicitOrDefaultVersion = explicitVersion ?: defaultLanguageVersion(collector)
if (useK2) {
when {
explicitVersion?.usesK2 == true -> {
collector.report(
CompilerMessageSeverity.STRONG_WARNING,
"Compiler flag -Xuse-k2 is redundant, the \"-language-version 2.0\" is used instead"
)
}
explicitVersion != null -> {
collector.report(
CompilerMessageSeverity.STRONG_WARNING,
"With -Xuse-k2 compiler flag \"-language-version $explicitVersion\" has no effect," +
" please remove -Xuse-k2 flag and use \"-language-version 2.0\" instead"
)
}
else -> {
collector.report(
CompilerMessageSeverity.STRONG_WARNING,
"Compiler flag -Xuse-k2 is deprecated, please use \"-language-version 2.0\" instead"
)
}
val message = when (explicitVersion?.usesK2) {
true ->
"Deprecated compiler flag -Xuse-k2 is redundant because of \"-language-version $explicitVersion\" and should be removed"
false ->
"Deprecated compiler flag -Xuse-k2 overrides \"-language-version $explicitVersion\" to 2.0;" +
" please remove -Xuse-k2 and use -language-version to select either $explicitVersion or 2.0"
null ->
"Compiler flag -Xuse-k2 is deprecated; please use \"-language-version 2.0\" instead"
}
collector.report(CompilerMessageSeverity.STRONG_WARNING, message)
}
return if (useK2 && !explicitOrDefaultVersion.usesK2) LanguageVersion.KOTLIN_2_0
else explicitOrDefaultVersion