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) @GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument( @Argument(
value = "-Xuse-fir", value = "-Xuse-k2",
description = "Compile using Front-end IR. Warning: this feature is far from being production-ready" 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( @Argument(
value = "-Xuse-fir-extended-checkers", 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.sanitizeParentheses] = sanitizeParentheses
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useK2
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
result[JvmAnalysisFlags.useIR] = !useOldBackend result[JvmAnalysisFlags.useIR] = !useOldBackend
return result return result
@@ -22,7 +22,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
createMetadataVersion: ((IntArray) -> BinaryVersion)? = null createMetadataVersion: ((IntArray) -> BinaryVersion)? = null
) { ) {
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline) 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.USE_FIR_EXTENDED_CHECKERS, arguments.useFirExtendedCheckers)
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker) put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot) putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
@@ -82,7 +82,7 @@ object FirKotlinToJvmBytecodeCompiler {
messageCollector.report( messageCollector.report(
STRONG_WARNING, 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 -> projectConfiguration.get(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS)?.let { pluginComponentRegistrars ->
@@ -97,7 +97,7 @@ fun compileModulesUsingFrontendIrAndLightTree(
messageCollector.report( messageCollector.report(
CompilerMessageSeverity.STRONG_WARNING, 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>() 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 // 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 useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false)
val useIR = arguments.useFir || val useIR = arguments.useK2 ||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) { if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
!useOldBackend !useOldBackend
} else { } else {
@@ -15,7 +15,7 @@ class FE1FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) { override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useIR = USE_BE_IR args.useIR = USE_BE_IR
args.useOldBackend = !USE_BE_IR args.useOldBackend = !USE_BE_IR
args.useFir = false args.useK2 = false
args.jvmDefault = "compatibility" args.jvmDefault = "compatibility"
args.apiVersion = "1.4" args.apiVersion = "1.4"
args.optIn = arrayOf( args.optIn = arrayOf(
@@ -12,7 +12,7 @@ private val LANGUAGE_VERSION: String = System.getProperty("fir.bench.language.ve
class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() { class FullPipelineModularizedTest : AbstractFullPipelineModularizedTest() {
override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) { override fun configureArguments(args: K2JVMCompilerArguments, moduleData: ModuleData) {
args.useFir = true args.useK2 = true
args.useIR = true args.useIR = true
args.apiVersion = LANGUAGE_VERSION args.apiVersion = LANGUAGE_VERSION
args.jvmDefault = "compatibility" args.jvmDefault = "compatibility"
@@ -88,7 +88,7 @@ fun makeIncrementally(
withIC(args) { withIC(args) {
val compiler = 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( IncrementalFirJvmCompilerRunner(
cachesDir, buildReporter, buildHistoryFile, emptyList(), EmptyModulesApiHistory, kotlinExtensions, ClasspathSnapshotDisabled cachesDir, buildReporter, buildHistoryFile, emptyList(), EmptyModulesApiHistory, kotlinExtensions, ClasspathSnapshotDisabled
) )
@@ -97,7 +97,7 @@ fun makeIncrementally(
cachesDir, cachesDir,
buildReporter, buildReporter,
// Use precise setting in case of non-Gradle build // 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(), outputFiles = emptyList(),
buildHistoryFile = buildHistoryFile, buildHistoryFile = buildHistoryFile,
modulesApiHistory = EmptyModulesApiHistory, modulesApiHistory = EmptyModulesApiHistory,
@@ -12,7 +12,7 @@ import java.io.File
abstract class AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() { abstract class AbstractIncrementalFirICLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true useK2 = true
useIR = true useIR = true
useFirIC = true useFirIC = true
useFirLT = true useFirLT = true
@@ -23,7 +23,7 @@ import java.io.File
abstract class AbstractIncrementalFirJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() { abstract class AbstractIncrementalFirJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true useK2 = true
useIR = true useIR = true
} }
@@ -12,7 +12,7 @@ import java.io.File
abstract class AbstractIncrementalFirLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() { abstract class AbstractIncrementalFirLightTreeJvmCompilerRunnerTest : AbstractIncrementalJvmCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JVMCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
useFir = true useK2 = true
useIR = true useIR = true
useFirIC = false useFirIC = false
useFirLT = true 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 -Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xunrestricted-builder-inference -Xunrestricted-builder-inference
Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call 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-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-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-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 -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 -Xverbose-phases Be verbose while performing these backend phases
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/conflictingProjection.kt $TESTDATA_DIR$/conflictingProjection.kt
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -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 '*' 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>) {} fun a8(value: Out<in Int>) {}
^ ^
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/extendedCheckers.kt $TESTDATA_DIR$/extendedCheckers.kt
-Xuse-fir -Xuse-k2
-Xuse-fir-extended-checkers -Xuse-fir-extended-checkers
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
compiler/testData/cli/jvm/extendedCheckers.kt:2:12: warning: redundant explicit type compiler/testData/cli/jvm/extendedCheckers.kt:2:12: warning: redundant explicit type
val i: Int = 1 val i: Int = 1
^ ^
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/extendedCheckersNoWarning.kt $TESTDATA_DIR$/extendedCheckersNoWarning.kt
-Xuse-fir -Xuse-k2
-Xuse-fir-extended-checkers -Xuse-fir-extended-checkers
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
OK 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 -Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xunrestricted-builder-inference -Xunrestricted-builder-inference
Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call 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-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-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-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 -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 -Xverbose-phases Be verbose while performing these backend phases
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/firError.kt $TESTDATA_DIR$/firError.kt
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
compiler/testData/cli/jvm/firError.kt:5:13: error: variable 'x' must be initialized compiler/testData/cli/jvm/firError.kt:5:13: error: variable 'x' must be initialized
println(x) println(x)
^ ^
+1 -1
View File
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/firHello.kt $TESTDATA_DIR$/firHello.kt
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
OK OK
@@ -2,7 +2,7 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt
$TESTDATA_DIR$/firMultiplatformCompilationWithError/jvm.kt $TESTDATA_DIR$/firMultiplatformCompilationWithError/jvm.kt
-Xcommon-sources -Xcommon-sources
$TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt $TESTDATA_DIR$/firMultiplatformCompilationWithError/common.kt
-Xuse-fir -Xuse-k2
-cp -cp
. .
-d -d
@@ -9,8 +9,8 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -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: 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| public abstract expect fun foo(): R|kotlin/Unit|
@@ -2,7 +2,7 @@ $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt
$TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/jvm.kt $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/jvm.kt
-Xcommon-sources -Xcommon-sources
$TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt $TESTDATA_DIR$/firMultiplatformCompilationWithoutErrors/common.kt
-Xuse-fir -Xuse-k2
-cp -cp
. .
-d -d
@@ -9,6 +9,6 @@ as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk! compiler or generated code. Use it at your own risk!
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
OK OK
+1 -1
View File
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/firStdlibDependency.kt $TESTDATA_DIR$/firStdlibDependency.kt
-Xuse-fir -Xuse-k2
-cp -cp
. .
-d -d
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
OK OK
+1 -1
View File
@@ -1,6 +1,6 @@
$TESTDATA_DIR$/firVsClassicAnnotation.kt $TESTDATA_DIR$/firVsClassicAnnotation.kt
-classpath -classpath
$TESTDATA_DIR$/firVsClassicAnnotation $TESTDATA_DIR$/firVsClassicAnnotation
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,4 +1,4 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
OK OK
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/inapplicableLateinitModifier.kt $TESTDATA_DIR$/inapplicableLateinitModifier.kt
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
compiler/testData/cli/jvm/inapplicableLateinitModifier.kt:6:1: error: 'lateinit' modifier is not allowed on delegated properties compiler/testData/cli/jvm/inapplicableLateinitModifier.kt:6:1: error: 'lateinit' modifier is not allowed on delegated properties
lateinit var kest by Delegate lateinit var kest by Delegate
^ ^
@@ -1,4 +1,4 @@
$TESTDATA_DIR$/instanceAccessBeforeSuperCall.kt $TESTDATA_DIR$/instanceAccessBeforeSuperCall.kt
-Xuse-fir -Xuse-k2
-d -d
$TEMP_DIR$ $TEMP_DIR$
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -Xuse-k2
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {} constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
^ ^
+1 -1
View File
@@ -2,5 +2,5 @@ $TESTDATA_DIR$/optInEmptyMessageFir.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-opt-in=kotlin.RequiresOptIn -opt-in=kotlin.RequiresOptIn
-Xuse-fir -Xuse-k2
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -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)' 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() foo()
^ ^
+1 -1
View File
@@ -2,4 +2,4 @@ $TESTDATA_DIR$/optInOverrideMessageFir.kt
-d -d
$TEMP_DIR$ $TEMP_DIR$
-opt-in=kotlin.RequiresOptIn -opt-in=kotlin.RequiresOptIn
-Xuse-fir -Xuse-k2
+2 -2
View File
@@ -1,6 +1,6 @@
warning: ATTENTION! warning: ATTENTION!
This build uses in-dev FIR: This build uses experimental K2 compiler:
-Xuse-fir -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)' 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() {} override fun foo() {}
^ ^
@@ -137,10 +137,7 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
private fun String.removeFirWarning(): String { private fun String.removeFirWarning(): String {
return this.replace( return this.replace(
"""warning: ATTENTION! "warning: ATTENTION!\n This build uses experimental K2 compiler: \n -Xuse-k2\n", ""
This build uses in-dev FIR:
-Xuse-fir
""", ""
) )
} }
@@ -546,7 +546,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
fun testInternalFromFriendModuleFir() { fun testInternalFromFriendModuleFir() {
val library = compileLibrary("library") 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() { fun testJvmDefaultClashWithOld() {
@@ -620,20 +620,20 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
} }
fun testFirAgainstFir() { fun testFirAgainstFir() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir")) val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2"))
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-fir")) compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xuse-k2"))
} }
fun testFirAgainstOldJvm() { fun testFirAgainstOldJvm() {
val library = compileLibrary("library") 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() { fun testFirIncorrectJavaSignature() {
compileKotlin( compileKotlin(
"source.kt", tmpdir, "source.kt", tmpdir,
listOf(), listOf(),
additionalOptions = listOf("-Xuse-fir"), additionalOptions = listOf("-Xuse-k2"),
additionalSources = listOf("A.java", "B.java"), additionalSources = listOf("A.java", "B.java"),
) )
} }
@@ -647,10 +647,10 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
} }
fun testOldJvmAgainstFir() { fun testOldJvmAgainstFir() {
val library = compileLibrary("library", additionalOptions = listOf("-Xuse-fir")) val library = compileLibrary("library", additionalOptions = listOf("-Xuse-k2"))
compileKotlin("source.kt", tmpdir, listOf(library)) 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)) compileKotlin("source.kt", tmpdir, listOf(library2))
} }
@@ -660,12 +660,12 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
} }
fun testOldJvmAgainstFirWithStableAbi() { 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)) compileKotlin("source.kt", tmpdir, listOf(library))
} }
fun testOldJvmAgainstFirWithAllowUnstableDependencies() { 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")) compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-unstable-dependencies"))
} }
@@ -95,7 +95,7 @@ class CompilerArgumentsContentProspectorTest {
CommonCompilerArguments::profilePhases, CommonCompilerArguments::profilePhases,
CommonCompilerArguments::checkPhaseConditions, CommonCompilerArguments::checkPhaseConditions,
CommonCompilerArguments::checkStickyPhaseConditions, CommonCompilerArguments::checkStickyPhaseConditions,
CommonCompilerArguments::useFir, CommonCompilerArguments::useK2,
CommonCompilerArguments::useFirExtendedCheckers, CommonCompilerArguments::useFirExtendedCheckers,
CommonCompilerArguments::disableUltraLightClasses, CommonCompilerArguments::disableUltraLightClasses,
CommonCompilerArguments::useMixedNamedArguments, CommonCompilerArguments::useMixedNamedArguments,
@@ -20,8 +20,8 @@ interface KotlinCommonOptions : org.jetbrains.kotlin.gradle.dsl.KotlinCommonToo
var languageVersion: kotlin.String? var languageVersion: kotlin.String?
/** /**
* Compile using Front-end IR. Warning: this feature is far from being production-ready * Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
* Default value: false * Default value: false
*/ */
var useFir: kotlin.Boolean var useK2: kotlin.Boolean
} }
@@ -152,7 +152,7 @@ internal open class GradleCompilerRunner(
report(BooleanMetrics.JVM_COMPILER_IR_MODE, args.useIR) report(BooleanMetrics.JVM_COMPILER_IR_MODE, args.useIR)
report(StringMetrics.JVM_DEFAULTS, args.jvmDefault) report(StringMetrics.JVM_DEFAULTS, args.jvmDefault)
report(StringMetrics.USE_OLD_BACKEND, args.useOldBackend.toString()) report(StringMetrics.USE_OLD_BACKEND, args.useOldBackend.toString())
report(StringMetrics.USE_FIR, args.useFir.toString()) report(StringMetrics.USE_FIR, args.useK2.toString())
} }
} }
is K2JSCompilerArguments -> { is K2JSCompilerArguments -> {
@@ -30,11 +30,11 @@ internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.Ko
override var languageVersion: kotlin.String? = null override var languageVersion: kotlin.String? = null
private var useFirField: kotlin.Boolean? = null private var useK2Field: kotlin.Boolean? = null
override var useFir: kotlin.Boolean override var useK2: kotlin.Boolean
get() = useFirField ?: false get() = useK2Field ?: false
set(value) { set(value) {
useFirField = value useK2Field = value
} }
private var friendModulesDisabledField: kotlin.Boolean? = null private var friendModulesDisabledField: kotlin.Boolean? = null
@@ -105,7 +105,7 @@ internal abstract class KotlinJsOptionsBase : org.jetbrains.kotlin.gradle.dsl.Ko
verboseField?.let { args.verbose = it } verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it } apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it } languageVersion?.let { args.languageVersion = it }
useFirField?.let { args.useFir = it } useK2Field?.let { args.useK2 = it }
friendModulesDisabledField?.let { args.friendModulesDisabled = it } friendModulesDisabledField?.let { args.friendModulesDisabled = it }
mainField?.let { args.main = it } mainField?.let { args.main = it }
metaInfoField?.let { args.metaInfo = it } metaInfoField?.let { args.metaInfo = it }
@@ -126,7 +126,7 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments.fil
verbose = false verbose = false
apiVersion = null apiVersion = null
languageVersion = null languageVersion = null
useFir = false useK2 = false
friendModulesDisabled = false friendModulesDisabled = false
main = "call" main = "call"
metaInfo = true metaInfo = true
@@ -30,11 +30,11 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
override var languageVersion: kotlin.String? = null override var languageVersion: kotlin.String? = null
private var useFirField: kotlin.Boolean? = null private var useK2Field: kotlin.Boolean? = null
override var useFir: kotlin.Boolean override var useK2: kotlin.Boolean
get() = useFirField ?: false get() = useK2Field ?: false
set(value) { set(value) {
useFirField = value useK2Field = value
} }
private var javaParametersField: kotlin.Boolean? = null private var javaParametersField: kotlin.Boolean? = null
@@ -68,7 +68,7 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
verboseField?.let { args.verbose = it } verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it } apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it } languageVersion?.let { args.languageVersion = it }
useFirField?.let { args.useFir = it } useK2Field?.let { args.useK2 = it }
javaParametersField?.let { args.javaParameters = it } javaParametersField?.let { args.javaParameters = it }
jvmTarget?.let { args.jvmTarget = it } jvmTarget?.let { args.jvmTarget = it }
moduleName?.let { args.moduleName = it } moduleName?.let { args.moduleName = it }
@@ -83,7 +83,7 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments.fi
verbose = false verbose = false
apiVersion = null apiVersion = null
languageVersion = null languageVersion = null
useFir = false useK2 = false
javaParameters = false javaParameters = false
jvmTarget = null jvmTarget = null
moduleName = null moduleName = null
@@ -30,11 +30,11 @@ internal abstract class KotlinMultiplatformCommonOptionsBase : org.jetbrains.kot
override var languageVersion: kotlin.String? = null override var languageVersion: kotlin.String? = null
private var useFirField: kotlin.Boolean? = null private var useK2Field: kotlin.Boolean? = null
override var useFir: kotlin.Boolean override var useK2: kotlin.Boolean
get() = useFirField ?: false get() = useK2Field ?: false
set(value) { set(value) {
useFirField = value useK2Field = value
} }
internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) { internal open fun updateArguments(args: org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments) {
@@ -43,7 +43,7 @@ internal abstract class KotlinMultiplatformCommonOptionsBase : org.jetbrains.kot
verboseField?.let { args.verbose = it } verboseField?.let { args.verbose = it }
apiVersion?.let { args.apiVersion = it } apiVersion?.let { args.apiVersion = it }
languageVersion?.let { args.languageVersion = it } languageVersion?.let { args.languageVersion = it }
useFirField?.let { args.useFir = it } useK2Field?.let { args.useK2 = it }
} }
} }
@@ -53,5 +53,5 @@ internal fun org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArgumen
verbose = false verbose = false
apiVersion = null apiVersion = null
languageVersion = null languageVersion = null
useFir = false useK2 = false
} }
@@ -132,8 +132,8 @@ internal class PropertiesProvider private constructor(private val project: Proje
val useKotlinAbiSnapshot: Boolean val useKotlinAbiSnapshot: Boolean
get() = booleanProperty(KOTLIN_ABI_SNAPSHOT) ?: false get() = booleanProperty(KOTLIN_ABI_SNAPSHOT) ?: false
val useFir: Boolean? val useK2: Boolean?
get() = booleanProperty("kotlin.useFir") get() = booleanProperty("kotlin.useK2")
val keepMppDependenciesIntactInPoms: Boolean? val keepMppDependenciesIntactInPoms: Boolean?
get() = booleanProperty("kotlin.mpp.keepMppDependenciesIntactInPoms") get() = booleanProperty("kotlin.mpp.keepMppDependenciesIntactInPoms")
@@ -36,8 +36,8 @@ internal class NativeCompileOptions(languageSettingsProvider: () -> LanguageSett
set(value) { set(value) {
languageSettings.languageVersion = value languageSettings.languageVersion = value
} }
override var useFir: Boolean override var useK2: Boolean
get() = false get() = false
set(@Suppress("UNUSED_PARAMETER") value) {} set(@Suppress("UNUSED_PARAMETER") value) {}
@@ -39,8 +39,8 @@ internal open class BaseKotlinCompileConfig<TASK : KotlinCompile> : AbstractKotl
taskProvider.configure { task -> taskProvider.configure { task ->
task.incremental = propertiesProvider.incrementalJvm ?: true task.incremental = propertiesProvider.incrementalJvm ?: true
if (propertiesProvider.useFir == true) { if (propertiesProvider.useK2 == true) {
task.kotlinOptions.useFir = true task.kotlinOptions.useK2 = true
} }
task.usePreciseJavaTracking = propertiesProvider.usePreciseJavaTracking ?: true task.usePreciseJavaTracking = propertiesProvider.usePreciseJavaTracking ?: true
task.jvmTargetValidationMode.set(propertiesProvider.jvmTargetValidationMode) task.jvmTargetValidationMode.set(propertiesProvider.jvmTargetValidationMode)
@@ -129,7 +129,7 @@ internal fun reportArgumentsNotAllowed(
K2JVMCompilerArguments::useJavac, K2JVMCompilerArguments::useJavac,
K2JVMCompilerArguments::useIR, K2JVMCompilerArguments::useIR,
K2JVMCompilerArguments::useOldBackend, K2JVMCompilerArguments::useOldBackend,
K2JVMCompilerArguments::useFir K2JVMCompilerArguments::useK2
) )
internal fun reportArgumentsIgnoredGenerally( internal fun reportArgumentsIgnoredGenerally(