KT-52217 Rename 'use-fir' to 'use-k2', update message

This commit is contained in:
Simon Ogorodnik
2022-04-26 16:16:38 +03:00
committed by Space
parent 1c90d8a960
commit 58885a1b07
52 changed files with 96 additions and 98 deletions
@@ -294,10 +294,11 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(
value = "-Xuse-fir",
description = "Compile using Front-end IR. Warning: this feature is far from being production-ready"
value = "-Xuse-k2",
deprecatedName = "-Xuse-fir",
description = "Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided"
)
var useFir: Boolean by FreezableVar(false)
var useK2: Boolean by FreezableVar(false)
@Argument(
value = "-Xuse-fir-extended-checkers",
@@ -528,7 +528,7 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useK2
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
result[JvmAnalysisFlags.useIR] = !useOldBackend
return result
@@ -22,7 +22,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
createMetadataVersion: ((IntArray) -> BinaryVersion)? = null
) {
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline)
put(CommonConfigurationKeys.USE_FIR, arguments.useFir)
put(CommonConfigurationKeys.USE_FIR, arguments.useK2)
put(CommonConfigurationKeys.USE_FIR_EXTENDED_CHECKERS, arguments.useFirExtendedCheckers)
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
@@ -82,7 +82,7 @@ object FirKotlinToJvmBytecodeCompiler {
messageCollector.report(
STRONG_WARNING,
"ATTENTION!\n This build uses in-dev FIR: \n -Xuse-fir"
"ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2"
)
projectConfiguration.get(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS)?.let { pluginComponentRegistrars ->
@@ -97,7 +97,7 @@ fun compileModulesUsingFrontendIrAndLightTree(
messageCollector.report(
CompilerMessageSeverity.STRONG_WARNING,
"ATTENTION!\n This build uses in-dev FIR: \n -Xuse-fir"
"ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2"
)
val outputs = mutableListOf<GenerationState>()
@@ -230,7 +230,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
// TODO: ignore previous configuration value when we do not need old backend in scripting by default
val useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false)
val useIR = arguments.useFir ||
val useIR = arguments.useK2 ||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
!useOldBackend
} else {
@@ -15,7 +15,7 @@ class FE1FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useIR = USE_BE_IR
args.useOldBackend = !USE_BE_IR
args.useFir = false
args.useK2 = false
args.jvmDefault = "compatibility"
args.apiVersion = "1.4"
args.optIn = arrayOf(
@@ -12,7 +12,7 @@ private val LANGUAGE_VERSION: String = System.getProperty("fir.bench.language.ve
class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useFir = true
args.useK2 = true
args.useIR = true
args.apiVersion = LANGUAGE_VERSION
args.jvmDefault = "compatibility"
@@ -88,7 +88,7 @@ fun makeIncrementally(
withIC(args) {
val compiler =
if (args.useFir && args.useFirIC && args.useFirLT /* TODO: move LT check into runner */ )
if (args.useK2 && args.useFirIC && args.useFirLT /* TODO: move LT check into runner */ )
IncrementalFirJvmCompilerRunner(
cachesDir, buildReporter, buildHistoryFile, emptyList(), EmptyModulesApiHistory, kotlinExtensions, ClasspathSnapshotDisabled
)
@@ -97,7 +97,7 @@ fun makeIncrementally(
cachesDir,
buildReporter,
// Use precise setting in case of non-Gradle build
usePreciseJavaTracking = !args.useFir, // TODO: add fir-based java classes tracker when available and set this to true
usePreciseJavaTracking = !args.useK2, // TODO: add fir-based java classes tracker when available and set this to true
outputFiles = emptyList(),
buildHistoryFile = buildHistoryFile,
modulesApiHistory = EmptyModulesApiHistory,
@@ -12,7 +12,7 @@ import java.io.File
abstract class AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true
useK2 = true
useIR = true
useFirIC = true
useFirLT = true
@@ -23,7 +23,7 @@ import java.io.File
abstract class AbstractIncrementalFirJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true
useK2 = true
useIR = true
}
@@ -12,7 +12,7 @@ import java.io.File
abstract class AbstractIncrementalFirLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true
useK2 = true
useIR = true
useFirIC = false
useFirLT = true
+1 -1
View File
@@ -104,10 +104,10 @@ where advanced options include:
-Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xunrestricted-builder-inference
Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-ic Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready
-Xuse-fir-lt Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready
-Xuse-k2 Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
-Xuse-mixed-named-arguments Enable Support named arguments in their own position even if the result appears as mixed
-Xverbose-phases Be verbose while performing these backend phases
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/conflictingProjection.kt
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/conflictingProjection.kt:10:19: error: projection is conflicting with variance of the corresponding type parameter of Out<in kotlin/Int>. Remove the projection or replace it with '*'
fun a8(value: Out<in Int>) {}
^
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/extendedCheckers.kt
-Xuse-fir
-Xuse-k2
-Xuse-fir-extended-checkers
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/extendedCheckers.kt:2:12: warning: redundant explicit type
val i: Int = 1
^
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/extendedCheckersNoWarning.kt
-Xuse-fir
-Xuse-k2
-Xuse-fir-extended-checkers
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
OK
+1 -1
View File
@@ -210,10 +210,10 @@ where advanced options include:
-Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xunrestricted-builder-inference
Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-ic Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready
-Xuse-fir-lt Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready
-Xuse-k2 Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
-Xuse-mixed-named-arguments Enable Support named arguments in their own position even if the result appears as mixed
-Xverbose-phases Be verbose while performing these backend phases
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/firError.kt
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/firError.kt:5:13: error: variable 'x' must be initialized
println(x)
^
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/firHello.kt
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
OK
@@ -2,7 +2,7 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt
$TESTDATA_DIR$/firMultiplatformCompilationWithError/jvm.kt
-Xcommon-sources
$TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt
-Xuse-fir
-Xuse-k2
-cp
.
-d
@@ -9,8 +9,8 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: actual class 'public abstract actual interface A : R|kotlin/Any|' has no corresponding members for expected class members:
public abstract expect fun foo(): R|kotlin/Unit|
@@ -2,7 +2,7 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt
$TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/jvm.kt
-Xcommon-sources
$TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt
-Xuse-fir
-Xuse-k2
-cp
.
-d
@@ -9,6 +9,6 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
OK
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/firStdlibDependency.kt
-Xuse-fir
-Xuse-k2
-cp
.
-d
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
OK
+1 -1
View File
@@ -1,6 +1,6 @@
$TESTDATA_DIR$/firVsClassicAnnotation.kt
-classpath
$TESTDATA_DIR$/firVsClassicAnnotation
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
OK
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/inapplicableLateinitModifier.kt
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/inapplicableLateinitModifier.kt:6:1: error: 'lateinit' modifier is not allowed on delegated properties
lateinit var kest by Delegate
^
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/instanceAccessBeforeSuperCall.kt
-Xuse-fir
-Xuse-k2
-d
$TEMP_DIR$
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
^
+1 -1
View File
@@ -2,5 +2,5 @@ $TESTDATA_DIR$/optInEmptyMessageFir.kt
-d
$TEMP_DIR$
-opt-in=kotlin.RequiresOptIn
-Xuse-fir
-Xuse-k2
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/optInEmptyMessageFir.kt:8:5: error: this declaration needs opt-in. Its usage must be marked with '@EmptyMarker' or '@OptIn(EmptyMarker::class)'
foo()
^
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/optInOverrideMessageFir.kt
-d
$TEMP_DIR$
-opt-in=kotlin.RequiresOptIn
-Xuse-fir
-Xuse-k2
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
This build uses experimental K2 compiler:
-Xuse-k2
compiler/testData/cli/jvm/optInOverrideMessageFir.kt:16:18: error: base declaration of supertype 'Base' needs opt-in. This API is experimental and can change at any time, please use with care. The declaration override must be annotated with '@Marker' or '@OptIn(Marker::class)'
override fun foo() {}
^
@@ -137,10 +137,7 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
private fun String.removeFirWarning(): String {
return this.replace(
"""warning: ATTENTION!
This build uses in-dev FIR:
-Xuse-fir
""", ""
"warning: ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2\n", ""
)
}
@@ -546,7 +546,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
fun testInternalFromFriendModuleFir() {
val library = compileLibrary("library")
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xfriend-paths=${library.path}", "-Xuse-fir"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xfriend-paths=${library.path}", "-Xuse-k2"))
}
fun testJvmDefaultClashWithOld() {
@@ -620,20 +620,20 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testFirAgainstFir() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-fir"))
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-k2"))
}
fun testFirAgainstOldJvm() {
val library = compileLibrary("library")
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-fir"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-k2"))
}
fun testFirIncorrectJavaSignature() {
compileKotlin(
"source.kt", tmpdir,
listOf(),
additionalOptions = listOf("-Xuse-fir"),
additionalOptions = listOf("-Xuse-k2"),
additionalSources = listOf("A.java", "B.java"),
)
}
@@ -647,10 +647,10 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testOldJvmAgainstFir() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir"))
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2"))
compileKotlin("source.kt", tmpdir, listOf(library))
val library2 = compileLibrary("library", additionalOptions = listOf("-Xuse-fir", "-Xabi-stability=unstable"))
val library2 = compileLibrary("library", additionalOptions = listOf("-Xuse-k2", "-Xabi-stability=unstable"))
compileKotlin("source.kt", tmpdir, listOf(library2))
}
@@ -660,12 +660,12 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
}
fun testOldJvmAgainstFirWithStableAbi() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir", "-Xabi-stability=stable"))
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2", "-Xabi-stability=stable"))
compileKotlin("source.kt", tmpdir, listOf(library))
}
fun testOldJvmAgainstFirWithAllowUnstableDependencies() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir"))
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-unstable-dependencies"))
}